June 2017
Beginner
1296 pages
69h 23m
English
... package of the class (e.g., java.lang), ClassName is the name of the class (e.g., Math) and staticMemberName is the name of the static field or method (e.g., PI or abs). In the following syntax, the asterisk (*) indicates that all static members of a class should be available for use in the file:
import static packageName.ClassName.*;
static import declarations import only static class members. Regular import statements should be used to specify the classes used in a program.
static ImportFigure 8.14 demonstrates a static import. Line 3 is a static import declaration, which imports all static fields and methods of class Math from package java.lang. Lines 7–10 access the Math class’s static methods sqrt (line 7) and ceil (line 8) and ...