INTRODUCTION
Introduction
1
Chapter 7 describes the structure of a Java program, which is organized into
packages similar to the modules of Modula. The members of a package are com
pilation units and subpackages. Compilation units contain type declarations and
can import types from other packages to give them short names. Packages have
names in a hierarchical namespace, and the Internet domain name system can be
used to form unique package names.
Chapter 8 describes Java's classes. The members of classes are fields (vari
ables) and methods. Class variables exist once per class. Class methods operate
without reference to a specific object. Instance variables are dynamically created
in objects that are instances of classes. Instance methods are invoked on instances
of classes; such instances become the current object
this
during their execution,
supporting the object oriented programming style.
Classes support single implementation inheritance, in which the implementa
tion of each class is derived from that of a single superclass, and ultimately from
the class
Object
. Variables of a class type can reference an instance of that class
or of any subclass of that class, allowing new types to be used with existing meth
ods, polymorphically.
Classes support concurrent programming with
synchronized
methods.
Methods declare the checked exceptions that can arise from their execution, which
allows compile time checking to ensure that exceptional conditions are handled.
Objects can declare a
finalize
method that will be invoked before the objects
are discarded by the garbage collector, allowing the objects to clean up their state.
For simplicity, Java has neither declaration headers separate from the imple
mentation of a class nor separate type and class hierarchies.
Although Java does not include parameterized classes, the semantics of arrays
are those of a parameterized class with some syntactic sugar. Like the program
ming language Beta, Java uses a run time type check when storing references in
arrays to ensure complete type safety.
Chapter 9 describes Java's interface types, which declare a set of abstract
methods and constants. Classes that are otherwise unrelated can implement the
same interface type. A variable of an interface type can contain a reference to any
object that implements the interface. Multiple interface inheritance is supported.
Chapter 10 describes Java arrays. Array accesses include bounds checking.
Arrays are dynamically created objects and may be assigned to variables of type
Object
. Java supports arrays of arrays, rather than multidimensional arrays.
Chapter 11 describes Java's exceptions, which are nonresuming and fully
integrated with the language semantics and concurrency mechanisms. There are
three kinds of exceptions: checked exceptions, run time exceptions, and errors.
The compiler ensures that checked exceptions are properly handled by requiring
that a method or constructor can result in a checked exception only if it declares it.
This provides compile time checking that exception handlers exist, and aids
3
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