PrimitiveType

An Overview of Java

Java is a powerful object oriented programming language created and maintained by Sun Microsystems. It was originally conceived of in the early 1990s as a language that could be used to program devices such as television set-top boxes, but grew into a more ambitious project. Java flourished into a language that was touted as the successor to C++. Indeed, Java borrows much of its syntax from C and C++ (making it part of the C family of languages), but is simpler and has fewer lower level features. Java has, however, more built-in support for networking.

The architect behind Java in the early 1990s was James Gosling. Java was originally code-named Oak but was renamed to Java as a reference to the type of coffee the programmers regularly drank to keep themselves awake. Some of the earliest Java demos were animations of Duke, the Java mascot.

Duke: Java Mascot

Sun put their muscle into promoting Java. The language has failed to dominate in some areas such as desktop programming, but is very popular as a server-side programming language, especially with large companies. Java has triumphed in the academic world and is now the language that is most taught at universities.

One of the principles of Java is "write once, run anywhere". This means that Java programmers should be able to write a program once that will work on all Java enabled machines, be they Windows, Apple or Linux systems. This is achieved by running the programs not directly on the machine, but on a Java Virtual Machine (JVM) - itself a program that runs natively on the machine. Java programs are compiled into bytecode, and it is this bytecode that is interpreted and executed by the JVM. Because of this interpreting stage, Java programs are slower on average than, say, natively compiled C programs. However, various performance enhancements have been made over the years, including smarter compilers and techniques such as Just In Time (JIT) compilation and dynamic recompilation, so that Java programs are much faster today than they were several years ago.

Another feature of Java's is automatic garbage collection. This means that programmers can create objects in their code and not worry about deleting them later, as memory management is handled by the JVM. Similar features can be added to C++ programs with the use of third party software.

One of Java's main uses is as a server-side programming language used to power Java Servlets and Java Server Pages (JSP). Java has the power of a fully fledged programming language, so is more suited to certain tasks than scripting languages, though some consider Java to be too complicated for web scripting.

Java can also be used to write applets, small programs that run inside larger programs. A typical example is a Java applet that runs inside a Java enabled web browser. Applets in web browsers were fairly popular in the mid to late 1990s, but have largely been replaced by Flash and Ajax programs.

A special edition of Java exists for mobile phones, and there is currently a large collection of Java games available for download.

Java is not a pure object oriented language as its primitive types (such as integers, floating point numbers, booleans and characters) are not objects. This has to do with performance issues - it keeps Java a bit faster and less memory consuming. As of Java 5, however, autoboxing can be used so that primitive types are treated as objects. Arrays and strings in Java are objects, but there is special syntax that makes it more convenient - if less object oriented in coded appearance - to create them.

A popular application written entirely in Java is LimeWire, a client for the Gnutella peer-to-peer file sharing network. Java's built-in networking facilities make it an ideal choice for such a program. LimeWire is open source and its source Java code can be downloaded from the LimeWire website.

Books about the Java programming language:
Introduction to Java Programming-Comprehensive Version (6th Edition)
Thinking in Java (4th Edition)