The thing that Java tries to do and is actually remarkably successful at is spanning a lot of different domains, so you can do app server work, you can do cell phone work, you can do scientific programming, you can write software, do interplanetary navigation, all kinds of stuff...
- Java language creator James Gosling
When the Java programming language was unleashed on the public in 1995, it was an inventive toy for the Web that had the potential to be more.
The word “potential” is a compliment that comes with an expiration date. Sooner or later, potential must be realized, or new words and phrases are used in its place, such as “slacker,” “letdown,” “waste,” or “major disappointment to your mother and me.”
As you develop your skills in my blog tutorials, you’ll be in a good position to judge whether the language has lived up to more than a decade of hype.
You’ll also become a Java programmer with a lot of potential.
The Java Language
Now in its ninth major release, Java has lived up to the expectations that accompanied its arrival. More than four million programmers have learned the language and are using it in places such as NASA, IBM, Kaiser Permanente, and Google. It’s a standard part of the academic curriculum at many computer science departments around the world. First used to create simple programs on web pages, Java can be found today in the following places (and many more):
- Web servers
- Relational databases
- Orbiting telescopes
- E-book readers
- Cell phones
Although Java remains useful for web developers, its ambitions today extend far beyond the Web. Java has matured into one of the most popular general-purpose programming languages.
History of the Java Language
The story of the Java language is well known by this point. James Gosling and a team of developers were working on an interactive TV project at Sun Microsystems in the mid-1990s when Gosling became frustrated with the language being used. C++ was an object-oriented programming language developed a decade earlier as an extension of the C language.
To address some of the things that frustrated him about C++, Gosling holed up in his office and created a new language that was suitable for his project.
Although that interactive TV effort flopped, Gosling’s language had unforeseen applicability to a new medium that was becoming popular at the same time: the Web.
Java was released to the public for the first time in 1995. Although most of the language’s features were primitive compared with C++ (and Java today), special Java programs called applets could be run as part of web pages on the most popular web browser at that time, Netscape Navigator.
This functionality - the first interactive programming available on the Web - drew so much attention to the new language that several hundred thousand programmers learned Java in its first six months.
Even after the novelty of Java web programming wore off, the overall benefits of the language became clear, and the programmers stuck around. There are more professional Java programmers today than C++ programmers.
Sun Microsystems controlled the development of the Java language from its inception until 2010, when the company was acquired by the database and enterprise software giant Oracle in a $7.4 billion deal. Oracle, a longtime user of the language on its own products, has a strong commitment to supporting Java and continues to increase its capabilities with each new release.
Introduction to Java
Java is an object-oriented, platform-neutral, secure language designed to be easier to learn than C++ and harder to misuse than C and C++.
Object-oriented programming (OOP) is a software development methodology in which a program is conceptualized as a group of objects that work together. Objects are created from templates called classes, and they contain data and the statements required to use that data. Java is primarily object-oriented, as you’ll see later today when you create your first class and use it to create objects.
Platform neutrality is a program’s ability to run without modification in different computing environments. Java programs are transformed into a format called bytecode that can be run by any computer or device equipped with a Java Virtual Machine (JVM). You can create a Java program on a Windows 10 machine that runs on a Linux web server, an Apple Mac using OS 10.10, and a Samsung Android phone. As long as a platform has a JVM, it can run the bytecode.
Although the relative ease of learning one language over another is always a point of contention among programmers, Java was designed to be easier than C++ primarily in the following ways:
- Java automatically takes care of memory allocation and deallocation, freeing programmers from this error-prone and complex task.
- Java doesn’t include pointers, a powerful feature for experienced programmers that can be easily misused and introduce major security vulnerabilities.
- Java includes only single inheritance in object-oriented programming.
The lack of pointers and the presence of automatic memory management are two key elements of Java security.
Selecting a Java Development Tool
Now that you’ve been introduced to Java as a spectator, it’s time to put some of these concepts into play and create your first Java program.
If you work your way through the my blog, you’ll become well versed in Java’s capabilities, including graphics, file input and output, XML processing, and Android app development. You will write programs that run on web pages and others that run on your computer, web servers, or other computing environments.
Before you get started, you must have software on your computer that can be used to edit, prepare, and run Java programs that use the most up-to-date version of the language: Java 8.
Several popular integrated development environments (IDEs) for Java support version 8, including IntelliJ IDEA and the open source software Eclipse.
If you are learning to use these tools at the same time as you are learning Java, it can be a daunting task. Most IDEs are aimed primarily at experienced programmers who want to be more productive, not new people who are taking their first foray into a new language.
The simplest tool for Java development is the Java Development Kit, which is free and can be downloaded from this link.
Whenever Oracle releases a new version of Java, it also makes a free development kit available over the Web to support that version. The current release is Java SE Development Kit 8.
The drawback of developing Java programs with the JDK is that it is a set of command-line tools. Therefore, it has no graphical user interface for editing programs, turning them into Java classes, and testing them. (A command line is simply a prompt for typing text commands. It’s available in Windows as the program Command Prompt.)
Oracle offers an excellent free IDE for Java programmers called NetBeans on the website. Because NetBeans is easier to use for most people than the JDK, it’s employed throughout my blog.
As soon as you have a Java development tool on your computer that supports Java 8, you’re ready to dive into the language.
If you don’t have one on your computer yet, now’s the time to set one up - preferably NetBeans.