12
C H A P T E R
Execution
We must all hang together, or assuredly we shall all hang separately.
Benjamin Franklin (July 4, 1776)
T
HIS chapter specifies activities that occur during execution of a Java program.
It is organized around the life cycle of a Java Virtual Machine and of the classes,
interfaces, and objects that form a Java program.
A Java Virtual Machine starts up by loading a specified class and then invok
ing the method
main
in this specified class. Section 12.1 outlines the loading,
linking, and initialization steps involved in executing
main
, as an introduction to
the concepts in this chapter. Further sections specify the details of loading ( 12.2),
linking ( 12.3), and initialization ( 12.4).
The chapter continues with a specification of the procedures for creation of
new class instances ( 12.5); finalization of class instances ( 12.6); and finaliza
tion of classes ( 12.7). It concludes by describing the unloading of classes ( 12.8)
and the procedure followed when a virtual machine exits ( 12.9).
12.1 Virtual Machine Start Up
A Java Virtual Machine starts execution by invoking the method
main
of some
specified class, passing it a single argument, which is an array of strings. In the
examples in this specification, this first class is typically called
Test
.
The manner in which the initial class is specified to the Java Virtual Machine
is beyond the scope of this specification, but it is typical, in host environments that
use command lines, for the fully qualified name of the class to be specified as a
command line argument and for following command line arguments to be used as
strings to be provided as the argument to the method
main
. For example, in a
UNIX implementation, the command line:
java Test reboot Bob Dot Enzo
215
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved