Java Reference
In-Depth Information
CHAPTER
7
Advanced Java
Language Concepts
This chapter is a potpourri of Java topics that are essential to your understand-
ing of how Java works. Topics discussed in this chapter include packages, the
access specifiers, encapsulation, the static keyword, and Java documentation.
An Overview of Packages
Every class belongs to a package. Packages have two basic purposes:
Packages provide a mechanism for organizing classes.
■■
Packages provide a namespace for the classes within the package.
■■
When developing a Java program, you put classes that go together in the
same package. For example, in the J2SE, the classes that are used to perform
input and output are in the java.io and java.nio packages. The fundamental
classes of the Java language are in the java.lang package. The classes used for
networking and sockets are in the java.net package. The classes used for creat-
ing GUI applications are in the java.awt, javax.swing, and other packages.
I can go on and on because there are about 136 packages in the J2SE, depend-
ing on the version of J2SE.
175
Search WWH ::




Custom Search