Java Reference
In-Depth Information
5
Defining Classes II
5.1 STATIC METHODS AND STATIC
VARIABLES
261
Static Methods 261
Static Variables 268
The
Math
Class 273
Wrapper Classes 277
Automatic Boxing and Unboxing 278
Static Methods in Wrapper Classes 280
5.3 USING AND MISUSING REFERENCES
303
Example: A Person Class 304
Copy Constructors 313
Mutable and Immutable Classes 319
5.4 PACKAGES AND
javadoc
322
Packages and
import
Statements 323
The Package
java.lang
324
Package Names and Directories 324
The Default Package 327
Specifying a Class Path When You Compile
5.2 REFERENCES AND CLASS
PARAMETERS
284
Variables and Memory 285
References 286
Class Parameters 291
The Constant
null
297
The
new
Operator and Anonymous Objects 298
Example: Another Approach to
Keyboard Input
★
★
328
Name Clashes
329
Introduction to
javadoc
★
★
330
Commenting Classes for
javadoc
★
330
Running
javadoc
★
332
299
Chapter Summary 334
Answers to Self-Test Exercises 335
Programming Projects 339