III |
At the top of the hierarchy presented in this reference section
are the packages. For convenience, classes and interfaces having
similar purposes are grouped into a package. This same grouping
has been used in the chapters. Each chapter corresponds to a package
and its components. For easy identification, icons have been designed
to represent each of these packages, as shown here:
Package java.lang | |
Package java.io | |
Package java.util | |
Package java.net | |
Package java.awt | |
Package java.awt.image | |
Package java.awt.peer | |
Package java.applet | |
Package sun.tools.debug |
Next in the hierarchy are the components of the Java packages-the
classes and interfaces. The name of each of these is preceded
by an icon representative of its type. On the right side of the
title line is an icon showing the package of which it is a part.
Here are these icons:
Class | |
Error class | |
Exception class | |
Interface |
Delving deeper into the hierarchy, we arrive at the methods and
constructors that are exposed by the classes and interfaces. The
title line for each of these is preceded by an icon distinguishing
its type. Then, on the far right of the title line, a backwards
reference shows the class or interface of which it's a part. The
following icons show these types of entries:
Constructor. This is a special method that is called when an object is being instantiated. | |
Method. |
The lowest point on the hierarchy is a description and cross section
of the element being described. In this description each important
point is preceded by an icon showing its identity. Here are the
icons:
Extends. This icon is applicable to a class or interface entry and is used to show its derivation from a superclass. | |
Implements. Applicable to a class, this icon points out an interface that is implemented in this class. | |
Overrides. This icon indicates a method that overrides a method from the superclass. | |
Parameter. This icon indicates a parameter into the method. | |
Returns. This icon indicates the return value from a method. | |
Throws. This icon indicates an exception that is thrown due to abnormal conditions. |
This section of the book deviates a little from the Sams Publishing norm. In order for a reference tome to succeed, there are two very important components. The first and certainly most important is the content of the information. Since books are similar to any other project in that different people bring different talents, we think that we have succeeded in this component by providing the expertise and viewpoint of more than one author.
The second vital component to a successful reference book is the presentation of the material. No matter how good and useful the information is, if it is not presented well, it becomes worthless. In the case of this part of Java Developer's Reference, we think we have succeeded because we have drawn on research findings in multimedia presentation. Each element in this section has strong visual separation from other elements as well as strong visual cues in the presentation of its important facets. Each entry also has backward reference to its "parent" information. If you were to let this section fall open to any page, you could easily tell where the information falls in relation to the other information.
To help you understand how to read this section, here's an example
from package java.util:
Note |
The next line shows that the class BitSet (left in the title line) is defined in package java.util (right side of line). |
BitSet |
Note |
The next line shows that the class BitSet is a subclass derived from superclass Object. |
Object |
Note |
The next line shows that the class BitSet implements the Cloneable interface. |
Cloneable |
Note |
The next part just talks about the class BitSet. |
The class java.util.BitSet is derived directly from Object but also implements the Cloneable interface.
This class represents a dynamically sized set of bits. Two constructors are provided-one that creates an empty set of unspecified size and one that creates a set of a specified size. The set method can be used to set an individual bit and clear can be used to clear an individual bit. The first bit in a BitSet is the zero bit; therefore, myBitset.set(0) is a valid statement.
The logical functions and,
or, and xor
are all supported and will combine the BitSet
with another set. BitSets
can be compared for equality using equals
and can be converted to Strings
using toString. For the purpose
of converting a BitSet to
a String, a set bit is represented
by the value 1 and a clear
bit is represented by 0.
Note |
The next line shows that get is one of the methods (icon on left side of the line) for the class (icon on the right side) BitSet, which is defined in package java.util. |
get | BitSet |
public boolean get(int bit)
Gets the value of a specified bit in the set.
Note |
The next line shows that this method has a single parameter into it called bit. |
Bit is the bit to get. |
Note |
The next line shows that this method returns either true or false: |
true if the bit is set; false if it is clear. |
Note |
The next line shows that this method throws an exception Ooops when the bit is both set and clear (<g>). |
Ooops if the bit is set and clear. |
As an added value, the CD-ROM supplied with this book has the same information as this reference section. The best part is that this information is an HTML file that you can browse. Each of the visual elements in this file is a link to the other information.