1
Introduction
INTRODUCTION
programming in the large. Most user defined exceptions should be checked excep
tions. Invalid operations in the program detected by the Java Virtual Machine
result in run time exceptions, such as
NullPointerException
. Errors result
from failures detected by the virtual machine, such as
OutOfMemoryError
. Most
simple programs do not try to handle errors.
Chapter 12 describes activities that occur during execution of a Java program.
A Java program is normally stored as binary files representing compiled classes
and interfaces. These binary files can be loaded into a Java Virtual Machine,
linked to other classes and interfaces, and initialized.
After initialization, class methods and class variables may be used. Some
classes may be instantiated to create new objects of the class type. Objects that are
class instances also contain an instance of each superclass of the class, and object
creation involves recursive creation of these superclass instances.
When an object is no longer referenced, it may be reclaimed by the garbage
collector. If an object declares a finalizer, the finalizer is executed before the
object is reclaimed to give the object a last chance to clean up resources that
would not otherwise be released. When a class is no longer needed, it may be
unloaded; if a class finalizer is declared, it is given a chance to clean up first.
Objects and classes may be finalized on exit of the Java Virtual Machine.
Chapter 13 describes binary compatibility, specifying the impact of changes
to types on other types that use the changed types but have not been recompiled.
These considerations are of interest to developers of types that are to be widely
distributed, in a continuing series of versions, often through the Internet. Good
program development environments automatically recompile dependent code
whenever a type is changed, so most programmers need not be concerned about
these details.
Chapter 14 describes Java's blocks and statements, which are based on C and
C++. Java has no
goto
, but includes labeled
break
and
continue
statements.
Unlike C, Java requires
boolean
expressions in control flow statements, and does
not convert types to
boolean
implicitly, in the hope of catching more errors at
compile time. A
synchronized
statement provides basic object level monitor
locking. A
try
statement can include
catch
and
finally
clauses to protect
against non local control transfers.
Chapter 15 describes Java's expressions. Java fully specifies the (apparent)
order of evaluation of expressions, for increased determinism and portability.
Overloaded methods and constructors are resolved at compile time by picking the
most specific method or constructor from those which are applicable. Java
chooses which method or constructor by using the same basic algorithm used in
languages with richer dispatching, such as Lisp's CLOS and Dylan, for the future.
Chapter 16 describes the precise way in which Java ensures that local vari
ables are definitely set before use. While all other variables are automatically ini
4
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