Java Reference
In-Depth Information
FIGURE 3.3
A page from the online Java API documentation
to get comfortable navigating this site and learning how the information is orga-
nized. The entire set of Java API documentation can be downloaded so that you
have a local copy always available, or you can rely on the online version.
Declaration
The classes of the
java.lang
package are automatically available for use when
writing a Java program. To use classes from any other package, however, we
must either
fully qualify
the reference or use an
import declaration
. Recall that
the example programs that use the
Scanner
class include an
import
declaration.
When you want to use a class from a class library in a program, you could
use its fully qualified name, including the package name, every time it is ref-
erenced. For example, every time you want to refer to the
Scanner
class that
is defined in the
java.util
package, you could write
java.util.Scanner
.
However, completely specifying the package and class name every time it is
needed quickly becomes tiring. Java provides the
import
declaration to simplify
these references.
The
import
Search WWH ::
Custom Search