About Our Examples

The Java Tutorial contains hundreds of complete working examples. Some of our examples are applets, others are standalone applications. This page contains three sections that discuss various aspects of our examples:

Example Directory Names

Each example belongs with a particular lesson and lives in an example directory within that lesson. A lesson might have one or more of the following example directories:

Example Directory Name Program Type JDK Release/Version Other libraries
example Applets and/or applications JDK 1.0.2  
example-1dot1 Applets and/or applications JDK 1.1  
example-1dot2 Applets and/or applications JDK 1.2 Beta 4  
example-swing Applets and/or applications JDK 1.1 Swing 1.1 Beta 3
example-swing-applet Applets only JDK 1.1 Swing 1.0.3

Multiple Versions of the Same Program

Often, you can find multiple versions of the same program by looking in each of the example directories in a lesson. For example, you might find a JDK 1.0.2 version of a program in example and a JDK 1.1 version of the same program in example-1dot1.

We provide multiple versions of the same program for several reasons:

About the Applets Running in our Pages

You will find four different versions of applets running on our pages:
JDK 1.0.2 Applets
These applets are included with an <APPLET> tag. We still run the 1.0.2 versions of the applets even if we have a 1.1 or higher version available because some older browsers don't support anything higher. This ensures that most of our readers can run the applet. These applets are followed by a note that looks like this (the links below don't work):

Note: Because some old browsers don't support 1.1, the above applet is a 1.0 version (here is the 1.0 code; here's the 1.1 code). To run the 1.1 version of the applet, go to example-1dot1/nothing.html. For more information about running applets, refer to About Our Examples.
JDK 1.1 Applets
These applets are included with an <APPLET> tag. We run a 1.1 version of an applet only if no 1.0.2 version of the applet is available (usually because 1.0.2 doesn't support required functionality). These applets are followed by a note that looks like this:

Note: The above applet requires JDK 1.1. If you are using an older browser that does not support 1.1, you won't be able to run the applet. Instead, you need to view this page in a 1.1 browser, such as HotJava, the JDK Applet Viewer (appletviewer), or certain versions of Netscape Navigator and Internet Explorer. For more information about running applets, refer to About Our Examples.
JDK 1.2 Applets
These applets are included with an <APPLET> tag. We run a 1.2 version of an applet only if no 1.0.2 or 1.1 version of the applet is available (usually because 1.0.2 and 1.1 don't support required functionality). These applets are followed by a note that looks like this:

Note: The above applet requires JDK 1.2. If you are using a browser that does not support 1.2, you won't be able to run the applet. Instead, you need to view this page in a 1.2 browser such as the JDK Applet Viewer (appletviewer). For more information about running applets, refer to About Our Examples.
Swing Applets
These applets require Java Plug-in 1.1.1 or a specially configured 1.1 browser. We include them using <APPLET>, <OBJECT>, and <EMBED> tags. Java Plug-in 1.1.1 supports Swing 1.0.3, so the running versions of these applets live in example-swing-applet. You can find the Swing 1.1 Beta 3 versions of these applets in example-swing, and you can run these with the Applet Viewer. For more information about running Swing applets, see Running a Swing Applet(in the Creating a User Interface trail).

Swing applets are followed by a note that looks like this (the links below don't work):


Note: Because the preceding applet runs using Java Plug-in 1.1.1, it is a Swing 1.0.3 version of the applet. To run the Swing 1.1 Beta 3 version of the applet, you can use the JDK Applet Viewer to view nothing.html, specifying swing.jar in the Applet Viewer's class path. For more information about running applets, refer to About Our Examples.