Java Overview

Java makes a basic distinction between two types of programs: applications and applets. Applications resemble conventional stand-alone programs and are executed within the Java Virtual Machine running in the general computing environment. Applets, however, are run within the Java Virtual Machine that is normally running within a WWW browser. Consequently, applets are not normally stored within the user's computer but, rather, within a WWW server and are delivered to the browser, when requested, through the Internet.

This distinction is suggested in the figure, below, in which an application is accessed on the right and an applet on the left of the figure.

Java context. Applications, shown on the right, are executed directly by the JVM within the user's computer. Applets, shown on the left, are normally executed by the JVM within the user's WWW browser.

The sections that follow discuss, first, the overall process of writing, compiling, and executing applications and applets, and, second, the basic Java constructs required for these two types of programs.


Java Data Flow

Constructing a Java program is a four or five step process:
  1. Write the source code.
  2. Compile it.
  3. Store it where it can be accessed by the JVM.
  4. Execute it through the JVM.
An additional step is required for applets: creating an HTML page that includes an APPLET tag that references the applet. It is this HTML page that is accessed by a WWW browser that results in the fetching of the applet and the running of it within the browser.

Java Program Construct

Examples of a minimal Java application, applet, and HTML applet tag are shown.