| |
| |
Preface | |
| |
| |
Notational Conventions | |
| |
| |
| |
Running Java: Compilation, Loading, and Execution | |
| |
| |
| |
Names and Reserved Names | |
| |
| |
| |
Java Naming Conventions | |
| |
| |
| |
Comments and Program Layout | |
| |
| |
| |
Types | |
| |
| |
| |
Primitive Types | |
| |
| |
| |
Reference Types | |
| |
| |
| |
Array Types | |
| |
| |
| |
Boxing: Wrapping Primitive Types As Reference Types | |
| |
| |
| |
Subtypes and Compatibility | |
| |
| |
| |
Signatures and Subsumption | |
| |
| |
| |
Type Conversion | |
| |
| |
| |
Variables, Parameters, Fields, and Scope | |
| |
| |
| |
Values Bound to Variables, Parameters, or Fields | |
| |
| |
| |
Variable Declarations | |
| |
| |
| |
Scope of Variables, Parameters, and Fields | |
| |
| |
| |
Strings | |
| |
| |
| |
String Formatting (Java 5.0) | |
| |
| |
| |
Arrays | |
| |
| |
| |
Array Creation and Access | |
| |
| |
| |
Array Initializers | |
| |
| |
| |
Multidimensional Arrays | |
| |
| |
| |
The Utility Class Arrays | |
| |
| |
| |
Classes | |
| |
| |
| |
Class Declarations and Class Bodies | |
| |
| |
| |
Top-Level Classes, Nested Classes, Member Classes, and Local Classes | |
| |
| |
| |
Class Modifiers | |
| |
| |
| |
The Class Modifiers public, final, abstract | |
| |
| |
| |
Subclasses, Superclasses, Class Hierarchy, Inheritance, and Overriding | |
| |
| |
| |
Field Declarations in Classes | |
| |
| |
| |
The Member Access Modifiers private, protected, public | |
| |
| |
| |
Method Declarations | |
| |
| |
| |
Parameter Arrays and Variable-Arity Methods (Java 5.0) | |
| |
| |
| |
Constructor Declarations | |
| |
| |
| |
Nested Classes, Member Classes, Local Classes, and Inner Classes | |
| |
| |
| |
Anonymous Classes | |
| |
| |
| |
Initializer Blocks, Field Initializers, and Initializers | |
| |
| |
| |
Classes and Objects in the Computer | |
| |
| |
| |
What Is a Class? | |
| |
| |
| |
What Is an Object? | |
| |
| |
| |
Inner Objects | |
| |
| |
| |
Expressions | |
| |
| |
| |
Table of Expression Forms | |
| |
| |
| |
Arithmetic Operators | |
| |
| |
| |
Logical Operators | |
| |
| |
| |
Bitwise Operators and Shift Operators | |
| |
| |
| |
Assignment Expressions | |
| |
| |
| |
Conditional Expressions | |
| |
| |
| |
Object Creation Expressions | |
| |
| |
| |
Instance Test Expressions | |
| |
| |
| |
Field Access Expressions | |
| |
| |
| |
The Current Object Reference this | |
| |
| |
| |
Type Cast Expression | |
| |
| |
| |
Method Call Expressions | |
| |
| |
| |
Statements | |
| |
| |
| |
Expression Statements | |
| |
| |
| |
Block Statements | |
| |
| |
| |
The Empty Statement | |
| |
| |
| |
Choice Statements | |
| |
| |
| |
Loop Statements | |
| |
| |
| |
Returns, Labeled Statements, Exits, and Exceptions | |
| |
| |
| |
The assert Statement | |
| |
| |
| |
Interfaces | |
| |
| |
| |
Interface Declarations | |
| |
| |
| |
Classes Implementing Interfaces | |
| |
| |
| |
Enum Types (Java 5.0) | |
| |
| |
| |
Exceptions, Checked and Unchecked | |
| |
| |
| |
Threads, Concurrent Execution, and Synchronization | |
| |
| |
| |
Threads and Concurrent Execution | |
| |
| |
| |
Locks and the synchronized Statement | |
| |
| |
| |
Operations on Threads | |
| |
| |
| |
Operations on Locked Objects | |
| |
| |
| |
Compilation, Source Files, Class Names, and Class Files | |
| |
| |
| |
Packages and Jar Files | |
| |
| |
| |
Mathematical Functions | |
| |
| |
| |
String Builders and String Buffers | |
| |
| |
| |
Generic Types and Methods (Java 5.0) | |
| |
| |
| |
Generics: Safety, Generality, and Efficiency | |
| |
| |
| |
Generic Types, Type Parameters, and Type Instances | |
| |
| |
| |
How Can Type Instances Be Used? | |
| |
| |
| |
Generic Classes | |
| |
| |
| |
Constraints on Type Parameters | |
| |
| |
| |
How Can Type Parameters Be Used? | |
| |
| |
| |
Generic Interfaces | |
| |
| |
| |
Generic Methods | |
| |
| |
| |
Wildcard Type Arguments | |
| |
| |
| |
The Raw Type | |
| |
| |
| |
The Implementation of Generic Types and Methods | |
| |
| |
| |
Generic Collections and Maps (Java 5.0) | |
| |
| |
| |
Interface Collection[left angle bracket]T[right angle bracket] | |
| |
| |
| |
Interface List[left angle bracket]T[right angle bracket] and Implementations LinkedList[left angle bracket]T[right angle bracket] and ArrayList[left angle bracket]T[right angle bracket] | |
| |
| |
| |
Interface Set[left angle bracket]T[right angle bracket] and Implementations HashSet[left angle bracket]T[right angle bracket] and LinkedHashSet[left angle bracket]T[right angle bracket] | |
| |
| |
| |
Interface SortedSet[left angle bracket]T[right angle bracket] and Implementation TreeSet[left angle bracket]T[right angle bracket] | |
| |
| |
| |
Interface Map[left angle bracket]K,V[right angle bracket] and Implementation HashMap[left angle bracket]K,V[right angle bracket] | |
| |
| |
| |
Interface SortedMap[left angle bracket]K,V[right angle bracket] and Implementation TreeMap[left angle bracket]K,V[right angle bracket] | |
| |
| |
| |
Going Through a Collection: Interfaces Iterator[left angle bracket]T[right angle bracket] and Iterable[left angle bracket]T[right angle bracket] | |
| |
| |
| |
Equality, Hash Codes, and Comparison | |
| |
| |
| |
The Utility Class Collections | |
| |
| |
| |
Choosing the Right Collection Class or Map Class | |
| |
| |
| |
Input and Output | |
| |
| |
| |
Creating Streams from Other Streams | |
| |
| |
| |
Kinds of Input and Output Methods | |
| |
| |
| |
Imports, Exceptions, Thread Safety | |
| |
| |
| |
Sequential Character Input: Readers | |
| |
| |
| |
Sequential Character Output: Writers | |
| |
| |
| |
Printing Primitive Data to a Character Stream: PrintWriter | |
| |
| |
| |
The Appendable Interface and the CharSequence Interface | |
| |
| |
| |
Reading Primitive Data from a Character Stream: StreamTokenizer | |
| |
| |
| |
Sequential Byte Input: InputStream | |
| |
| |
| |
Sequential Byte Output: OutputStream | |
| |
| |
| |
Binary Input-Output of Primitive Data: DataInput and DataOutput | |
| |
| |
| |
Serialization of Objects: ObjectInput and ObjectOutput | |
| |
| |
| |
Buffered Input and Output | |
| |
| |
| |
Random Access Files: RandomAccessFile | |
| |
| |
| |
Files, Directories, and File Descriptors | |
| |
| |
| |
Thread Communication: PipedInputStream and PipedOutputStream | |
| |
| |
| |
Socket Communication | |
| |
| |
| |
Reflection | |
| |
| |
| |
Reflective Use of Types: The Class[left angle bracket]T[right angle bracket] Class | |
| |
| |
| |
Reflection: The Field Class | |
| |
| |
| |
Reflection: The Method Class and the Constructor[left angle bracket]T[right angle bracket] Class | |
| |
| |
| |
Exceptions Thrown When Using Reflection | |
| |
| |
| |
Metadata Annotations (Java 5.0) | |
| |
| |
| |
What Is New in Java 5.0 | |