INTRODUCTION Organization of the Specification 1.1
3
loopholes in the language; casts on reference types are checked at run time to ensure
type safety.
Chapter 6 describes declarations and names, and how to determine what names
mean (that is, which declaration a name denotes). The Java programming language
does not require classes and interfaces, or their members, to be declared before
they are used. Declaration order is significant only for local variables, local classes,
and the order of field initializers in a class or interface. Recommended naming
conventions that make for more readable programs are described here.
Chapter 7 describes the structure of a program, which is organized into packages.
The members of a package are classes, interfaces, and subpackages. Packages,
and consequently their members, have names in a hierarchical name space; the
Internet domain name system can usually be used to form unique package names.
Compilation units contain declarations of the classes and interfaces that are
members of a given package, and may import classes and interfaces from other
packages to give them short names.
Packages may be grouped into modules that serve as building blocks in the
construction of very large programs. The declaration of a module specifies which
other modules (and thus packages, and thus classes and interfaces) are required in
order to compile and run code in its own packages.
The Java programming language supports limitations on external access to the
members of packages, classes, and interfaces. The members of a package may be
accessible solely by other members in the same package, or by members in other
packages of the same module, or by members of packages in different modules.
Similar constraints apply to the members of classes and interfaces.
Chapter 8 describes classes. The members of classes are classes, interfaces, fields
(variables) 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 inheritance, in which each class has a single superclass. Each
class inherits members from its 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 methods, 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