Java is a high-level programming language that is all of the following:
[PENDING: get table from book]
Each of the preceding buzzwords is explained in
The Java Language Environment
white paper, by James Gosling and Henry McGilton.
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.
[PENDING: get figure from book]
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.
[PENDING: get figure from book]
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:
-
The Java Virtual Machine (Java VM)
-
The Java Application Programming Interface (Java API)
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.
[PENDING: get figure from book]
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 Java Platform white
paper written by Doug Kramer on the Java Web site:
http://java.sun.com/docs/white/platform/CreditsPage.doc.html