11.3: Program Structure
- Page ID
- 15223
At this point, we have seen all of the elements that make up Java programs. Figure 3.3.1 shows these organizational units.
To review, a package is a collection of classes, which define methods. Methods contain statements, some of which contain expressions. Expressions are made up of tokens, which are the basic elements of a program, including numbers, variable names, operators, keywords, and punctuation like parentheses, braces and semicolons.
The standard edition of Java comes with several thousand classes you can import
, which can be both exciting and intimidating. You can browse this library at http://docs.oracle.com/javase/8/docs/api/. Most of the Java library itself is written in Java.
Note there is a major difference between the Java language, which defines the syntax and meaning of the elements in Figure 3.3.1, and the Java library, which provides the built-in classes.