The JavaTM Tutorial
Previous Page Lesson Contents Next Page Start of Tutorial > Start of Trail > Start of Lesson Search

Trail: Getting Started
Lesson: The Java Phenomenon

What Is Java?

Java is two things: a programming language and a platform.

The Java Programming Language

Java is a high-level programming language that is all of the following:

  • Simple
  • Architecture-neutral
  • Object-oriented
  • Portable
  • Distributed
  • High-performance
  • Interpreted
  • Multithreaded
  • Robust
  • Dynamic
  • Secure
  • Each of the preceding buzzwords is explained in The Java Language Environment, a white paper written by James Gosling and Henry McGilton. You can download a PostScript or PDF version of the paper from http://java.sun.com/docs/white/.

    Java is also unusual in that each Java program is both compiled and interpreted. With a compiler, you translate a Java program into an intermediate language called Java bytecodes--the platform-independent codes interpreted by the Java interpreter. With an interpreter, each Java bytecode instruction is parsed and run on the computer. Compilation happens just once; interpretation occurs each time the program is executed. This figure illustrates how this works.


    This figure has been reduced to fit on the page.
    Click the image to view it at its natural size.

    You can think of Java bytecodes as the machine code instructions for the Java Virtual Machine (Java VM). Every Java interpreter, whether it's a Java development tool or a Web browser that can run Java applets, is an implementation of the Java VM. The Java VM can also be implemented in hardware.

    Java bytecodes help make "write once, run anywhere" possible. You can compile your Java program into bytecodes on any platform that has a Java compiler. The bytecodes can then be run on any implementation of the Java VM. For example, the same Java program can run on Windows NT, Solaris, and Macintosh.


    This figure has been reduced to fit on the page.
    Click the image to view it at its natural size.

    The Java Platform

    A platform is the hardware or software environment in which a program runs. The Java platform differs from most other platforms in that it's a software-only platform that runs on top of other, hardware-based platforms. Most other platforms are described as a combination of hardware and operating system.

    The Java platform has two components:

    You've already been introduced to the Java VM. It's the base for the Java platform and is ported onto various hardware-based platforms.

    The Java API is a large collection of ready-made software components that provide many useful capabilities, such as graphical user interface (GUI) widgets. The Java API is grouped into libraries (packages) of related components. The next section, What Can Java Do?, highlights each area of functionality provided by the packages in the Java API.

    The following figure depicts a Java program, such as an application or applet, that's running on the Java platform. As the figure shows, the Java API and Virtual Machine insulates the Java program from hardware dependencies.

    As a platform-independent environment, Java can be a bit slower than native code. However, smart compilers, well-tuned interpreters, and just-in-time bytecode compilers can bring Java's performance close to that of native code without threatening portability.

    You can read more about the Java platform in the white paper, The Java Platform, written by Doug Kramer. You can download this paper in PostScript or PDF form from http://java.sun.com/docs/white/.


    Previous Page Lesson Contents Next Page Start of Tutorial > Start of Trail > Start of Lesson Search