4. Access Control

Image

4.1 Java Source File Structure

The structure of a skeletal Java source file is depicted in Figure 4.1. A Java source file can have the following elements that, if present, must be specified in the following order:

1. An optional package declaration to specify a package name. Packages are discussed in §4.2.

2. Zero or more import declarations. Since import declarations introduce type or static member names in the source code, they must be placed before any type declarations. Both type and static import declarations are discussed in §4.2.

3. Any number of top-level type declarations. Class, enum, and interface declarations are ...

Get A Programmer’s Guide to Java® SE 8 Oracle Certified Associate (OCA) now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.