Classes .........................................................................................
Identifying Classes ....................................................................
Using Predefined Classes .......................................................................
Class of the Java Library .....................................
Defining Your Own Classes ...................................................................
Use of Multiple Source Files ....................................................
First Steps with Constructors ..................................................
Benefits of Encapsulation .........................................................
ptg18360597
156
Private Methods .........................................................................
4.3.8
157
Final Instance Fields ..................................................................
4.3.9
158
Static Fields and Methods .......................................................................
4.4
158
Static Fields .................................................................................
4.4.1
159
Static Constants ..........................................................................
4.4.2
160
Static Methods ............................................................................
4.4.3
161
Factory Methods ........................................................................
4.4.4
161
The
main
Method .........................................................................
4.4.5
164
Method Parameters ..................................................................................
4.5
171
Object Construction .................................................................................
4.6
172
Overloading ................................................................................
4.6.1
172
Default Field Initialization .......................................................
4.6.2
173
The Constructor with No Arguments .....................................
4.6.3
174
Explicit Field Initialization .......................................................
4.6.4
175
Parameter Names ......................................................................
4.6.5
176
Calling Another Constructor ...................................................
4.6.6
177
Initialization Blocks ...................................................................
4.6.7
181
Object Destruction and the
finalize
Method ...........................
4.6.8
182
Packages ....................................................................................................
4.7
183
Class Importation ......................................................................
4.7.1
185
Static Imports .............................................................................
4.7.2
185
Addition of a Class into a Package .........................................
4.7.3
189
Package Scope ............................................................................
4.7.4
190
The Class Path ...........................................................................................
4.8
193
Setting the Class Path ................................................................
4.8.1
194
Documentation Comments ....................................................................
4.9
194
Comment Insertion ...................................................................
4.9.1
195
Class Comments ........................................................................
4.9.2
195
Method Comments ...................................................................
4.9.3
196
Field Comments ........................................................................
4.9.4
196
General Comments ...................................................................
4.9.5
198
Package and Overview Comments .........................................
4.9.6
198
Comment Extraction .................................................................
4.9.7
200
Class Design Hints ..................................................................................
4.10
Contents
viii
From the Library of Hristo Dimov Hristov