| Preface |
|
ix | |
| Notational Conventions |
|
x | |
|
Running Java: Compilation, Loading, and Execution |
|
|
2 | (1) |
|
|
|
2 | (1) |
|
|
|
2 | (1) |
|
Comments and Program Layout |
|
|
2 | (2) |
|
|
|
4 | (4) |
|
|
|
4 | (1) |
|
|
|
4 | (1) |
|
|
|
4 | (1) |
|
Boxing: Wrapping Primitive Types As Reference Types |
|
|
4 | (2) |
|
Subtypes and Compatibility |
|
|
6 | (1) |
|
Signatures and Subsumption |
|
|
6 | (1) |
|
|
|
6 | (2) |
|
Variables, Parameters, Fields, and Scope |
|
|
8 | (2) |
|
Values Bound to Variables, Parameters, or Fields |
|
|
8 | (1) |
|
|
|
8 | (1) |
|
Scope of Variables, Parameters, and Fields |
|
|
8 | (2) |
|
|
|
10 | (6) |
|
String Formatting (Java 5.0) |
|
|
12 | (4) |
|
|
|
16 | (4) |
|
Array Creation and Access |
|
|
16 | (1) |
|
|
|
16 | (2) |
|
|
|
18 | (1) |
|
|
|
18 | (2) |
|
|
|
20 | (12) |
|
Class Declarations and Class Bodies |
|
|
20 | (1) |
|
Top-Level Classes, Nested Classes, Member Classes, and Local Classes |
|
|
20 | (1) |
|
|
|
20 | (2) |
|
The Class Modifiers public, final, abstract |
|
|
22 | (1) |
|
Subclasses, Superclasses, Class Hierarchy, Inheritance, and Overriding |
|
|
22 | (2) |
|
Field Declarations in Classes |
|
|
24 | (1) |
|
The Member Access Modifiers private, protected, public |
|
|
24 | (2) |
|
|
|
26 | (2) |
|
Parameter Arrays and Variable-Arity Methods (Java 5.0) |
|
|
28 | (1) |
|
|
|
28 | (2) |
|
Nested Classes, Member Classes, Local Classes, and Inner Classes |
|
|
30 | (1) |
|
|
|
30 | (1) |
|
Initializer Blocks, Field Initializers, and Initializers |
|
|
30 | (2) |
|
Classes and Objects in the Computer |
|
|
32 | (2) |
|
|
|
32 | (1) |
|
|
|
32 | (1) |
|
|
|
32 | (2) |
|
|
|
34 | (12) |
|
Table of Expression Forms |
|
|
34 | (2) |
|
|
|
36 | (1) |
|
|
|
36 | (1) |
|
Bitwise Operators and Shift Operators |
|
|
36 | (2) |
|
|
|
38 | (1) |
|
|
|
38 | (1) |
|
Object Creation Expressions |
|
|
38 | (1) |
|
Instance Test Expressions |
|
|
38 | (2) |
|
|
|
40 | (1) |
|
The Current Object Reference this |
|
|
40 | (1) |
|
|
|
40 | (2) |
|
|
|
42 | (4) |
|
|
|
46 | (14) |
|
|
|
46 | (1) |
|
|
|
46 | (1) |
|
|
|
46 | (2) |
|
|
|
48 | (2) |
|
|
|
50 | (4) |
|
Returns, Labeled Statements, Exits, and Exceptions |
|
|
54 | (4) |
|
|
|
58 | (2) |
|
|
|
60 | (2) |
|
|
|
60 | (1) |
|
Classes Implementing Interfaces |
|
|
60 | (2) |
|
|
|
62 | (2) |
|
Exceptions, Checked and Unchecked |
|
|
64 | (2) |
|
Threads, Concurrent Execution, and Synchronization |
|
|
66 | (6) |
|
Threads and Concurrent Execution |
|
|
66 | (2) |
|
Locks and the synchronized Statement |
|
|
68 | (2) |
|
|
|
70 | (1) |
|
Operations on Locked Objects |
|
|
70 | (2) |
|
Compilation, Source Files, Class Names, and Class Files |
|
|
72 | (1) |
|
|
|
72 | (2) |
|
|
|
74 | (2) |
|
String Builders and String Buffers |
|
|
76 | (2) |
|
Generic Types and Methods (Java 5.0) |
|
|
78 | (14) |
|
Generics: Safety, Generality, and Efficiency |
|
|
78 | (1) |
|
Generic Types, Type Parameters, and Type Instances |
|
|
78 | (1) |
|
How Can Type Instances Be Used? |
|
|
78 | (2) |
|
|
|
80 | (2) |
|
Constraints on Type Parameters |
|
|
82 | (1) |
|
How Can Type Parameters Be Used? |
|
|
82 | (2) |
|
|
|
84 | (2) |
|
|
|
86 | (2) |
|
|
|
88 | (2) |
|
|
|
90 | (1) |
|
The Implementation of Generic Types and Methods |
|
|
90 | (2) |
|
Generic Collections and Maps (Java 5.0) |
|
|
92 | (18) |
|
|
|
94 | (1) |
|
Interface List<T> and Implementations LinkedList<T> and ArrayList<T> |
|
|
95 | (1) |
|
Interface Set<T> and Implementations HashSet<T> and LinkedHashSet<T> |
|
|
96 | (1) |
|
Interface SortedSet<T> and Implementation TreeSet<T> |
|
|
96 | (2) |
|
Interface Map<K, V> and Implementation HashMap<K, V> |
|
|
98 | (2) |
|
Interface SortedMap<K, V> and Implementation TreeMap<K, V> |
|
|
100 | (2) |
|
Going Through a Collection: Interfaces Iterator<T> and Iterable<T> |
|
|
102 | (2) |
|
Equality, Hash Codes, and Comparison |
|
|
104 | (2) |
|
The Utility Class Collections |
|
|
106 | (2) |
|
Choosing the Right Collection Class or Map Class |
|
|
108 | (2) |
|
|
|
110 | (24) |
|
Creating Streams from Other Streams |
|
|
111 | (1) |
|
Kinds of Input and Output Methods |
|
|
112 | (1) |
|
Imports, Exceptions, Thread Safety |
|
|
112 | (2) |
|
Sequential Character Input: Readers |
|
|
114 | (1) |
|
Sequential Character Output: Writers |
|
|
115 | (1) |
|
Printing Primitive Data to a Character Stream: PrintWriter |
|
|
116 | (1) |
|
The Appendable Interface and the CharSequence Interface |
|
|
116 | (2) |
|
Reading Primitive Data from a Character Stream: StreamTokenizer |
|
|
118 | (2) |
|
Sequential Byte Input: InputStream |
|
|
120 | (1) |
|
Sequential Byte Output: OutputStream |
|
|
121 | (1) |
|
Binary Input-Output of Primitive Data: DataInput and DataOutput |
|
|
122 | (2) |
|
Serialization of Objects: ObjectInput and ObjectOutput |
|
|
124 | (2) |
|
Buffered Input and Output |
|
|
126 | (2) |
|
Random Access Files: RandomAccessFile |
|
|
128 | (2) |
|
Files, Directories, and File Descriptors |
|
|
130 | (1) |
|
Thread Communication: PipedInputStream and PipedOutputStream |
|
|
130 | (2) |
|
|
|
132 | (2) |
|
|
|
134 | (4) |
|
Reflective Use of Types: The Class<T> Class |
|
|
134 | (2) |
|
Reflection: The Field Class |
|
|
136 | (1) |
|
Reflection: The Method Class and the Constructor<T> Class |
|
|
136 | (1) |
|
Exceptions Thrown When Using Reflection |
|
|
136 | (2) |
|
Metadata Annotations (Java 5.0) |
|
|
138 | (2) |
|
|
|
140 | (2) |
| References |
|
142 | (1) |
| Index |
|
143 | |