Next Prev Up Contents


1 Program Structure


The source code for an Java program consists of one or more compilation units. Each compilation unit can contain only the following (in addition to white space and comments):

Although each Java compilation unit can contain multiple classes or interfaces, at most one class or interface per compilation unit can be public (see "Classes" on page 11).

When Java source code is compiled, the result is Java bytecode. Java bytecode consists of machine-independent instructions that can be interpreted efficiently by the Java runtime system. The Java runtime system operates like a virtual machine, for information see The Java Virtual Machine Specification.

In the current Java implementation, each compilation unit is a file with a ".java" suffix.


Next Prev Up Contents

The Java Language Specification

Generated with CERN WebMaker