Java Reference
In-Depth Information
defined in the default package that has no name. The class name in a static import statement must always
be qualified with its package name.
Standard Packages
All of the standard classes that are provided with Java are stored in standard packages. There is a substantial
and growing list of standard packages but some of the ones you may hear about most frequently are found
in Table 5-1 .
TABLE 5-1 : Java Standard Packages
PACKAGE DESCRIPTION
java.lang Contains classes that are fundamental to Java (e.g., the Math class) and all of these are available
in your programs automatically. You do not need an import statement to include them.
java.nio.file Contains classes supporting file I/O in conjunction with the classes in the java.io package.
This package is new in JDK 7.
java.awt Contains classes that support Java's graphical user interface (GUI). Although you can use these
classes for GUI programming, it is almost always easier and better to use the alternative Swing
classes.
javax.swing Provides classes supporting the “Swing” GUI components. These are not only more flexible and
easier to use than the java.awt equivalents, but they are also implemented largely in Java with
minimal dependency on native code.
java.awt.event Contains classes that support event handling.
java.awt.geom Contains classes for drawing and operating with 2D geometric entities.
javax.swing.border Classes to support generating borders around Swing components.
javax.swing.event Classes supporting event handling for Swing components.
java.applet
Contains classes that enable you to write applets — programs that are embedded in a web page.
Contains classes that support a range of standard operations for managing collections of data,
accessing date and time information, and analyzing strings.
java.util
The standard packages and the classes they contain cover an enormous amount of ground, so even in a
book of this size it is impossible to cover them all exhaustively. There are now many more classes in the
standard packages than there are pages in this topic. However, you will apply some classes from all of the
packages in the preceding table, plus one or two others besides, in later chapters of the topic.
Standard Classes Encapsulating the Primitive Data Types
You saw in the previous chapter that you have classes available that enable you to define objects that encap-
sulate values of each of the primitive data types in Java. These classes are:
BooleanCharacterByte
Short Integer Long
Float Double
These are all contained in the package java.lang along with quite a few other classes, such as the
String and StringBuffer classes that you saw in Chapter 4. Each of these classes encapsulates a value
of the corresponding primitive type and includes methods for manipulating and interrogating objects of the
class, as well as a number of very useful static methods that provide utility functions for the underlying
primitive types.
 
 
Search WWH ::




Custom Search