A Quick Tour p. 1 Getting Started p. 1 Variables p. 3 Comments in Code p. 6 Named Constants p. 6 Unicode Characters p. 8 Flow of Control p. 9 Classes and Objects p. 11 Creating Objects p. 12 Static or Class Fields p. 13 The Garbage Collector p. 14 Methods and Parameters p. 14 Invoking a Method p. 15 The this Reference p. 16 Static or Class Methods p. 17 Arrays p. 17 String Objects p. 20 Extending a Class p. 22 Invoking Methods from the Superclass p. 23 The Object Class p. 24 Type Casting p. 25 Interfaces p. 25 Exceptions p. 27 Packages p. 30 The Java Platform p. 32 Other Topics Briefly Noted p. 33 Classes and Objects p. 35 A Simple Class p. 36 Class Members p. 36 Class Modifiers p. 37 Fields p. 38 Field Initialization p. 38 Static Fields p. 39 final Fields p. 40 Access Control p. 41 Creating Objects p. 42 Construction and Initialization p. 43 Constructors p. 44 Initialization Blocks p. 48 Static Initialization p. 49 Methods p. 50
Static Methods p. 51 Method Invocations p. 51 Method Execution and Return p. 53 Parameter Values p. 54 Using Methods to Control Access p. 57 this p. 59 Overloading Methods p. 61 The main Method p. 62 Native Methods p. 63 Extending Classes p. 65 An Extended Class p. 66 Constructors in Extended Classes p. 69 Constructor Order Dependencies p. 71 Inheriting and Redefining Members p. 73 Overriding p. 73 Hiding Fields p. 74 Accessing Inherited Members p. 75 Accessibility and Overriding p. 77 Hiding Static Members p. 77 The super Keyword p. 78 Type Compatibility and Conversion p. 79 Compatibility p. 79 Explicit Type Casting p. 80 Testing for Type p. 80 What protected Really Means p. 81 Marking Methods and Classes final p. 84 Abstract Classes and Methods p. 85 The Object Class p. 87 Cloning Objects p. 89 Strategies for Cloning p. 89 Correct Cloning p. 91 Shallow versus Deep Cloning p. 94 Extending Classes: How and When p. 95 Designing a Class to Be Extended p. 96 Designing an Extensible Framework p. 97 Single Inheritance versus Multiple Inheritance p. 102 Interfaces p. 105 A Simple Interface Example p. 106 Interface Declarations p. 108 Interface Constants p. 109 Interface Methods p. 109
Interface Modifiers p. 110 Extending Interfaces p. 110 Inheriting and Hiding Constants p. 111 Inheriting, Overriding, and Overloading Methods p. 112 Working with Interfaces p. 113 Implementing Interfaces p. 114 Using an Implementation p. 116 Marker Interfaces p. 117 When to Use Interfaces p. 118 Nested Classes and Interfaces p. 121 Static Nested Types p. 121 Static Nested Classes p. 122 Nested Interfaces p. 123 Inner Classes p. 123 Accessing Enclosing Objects p. 125 Extending Inner Classes p. 126 Inheritance, Scoping, and Hiding p. 127 Local Inner Classes p. 129 Anonymous Inner Classes p. 131 Inheriting Nested Types p. 132 Nesting in Interfaces p. 134 Modifiable Variables in Interfaces p. 135 Implementation of Nested Types p. 136 Tokens, Operators, and Expressions p. 137 Lexical Elements p. 137 Character Set p. 138 Comments p. 138 Tokens p. 139 Identifiers p. 140 Keywords p. 141 Types and Literals p. 141 Reference Literals p. 142 Boolean Literals p. 142 Character Literals p. 142 Integer Literals p. 143 Floating-Point Literals p. 143 String Literals p. 144 Class Literals p. 144 Variables p. 144 Field and Local Variable Declarations p. 145 Parameter Variables p. 146
final Variables p. 146 Array Variables p. 148 Array Modifiers p. 149 Arrays of Arrays p. 149 Array Initialization p. 150 Arrays and Types p. 151 The Meanings of Names p. 152 Arithmetic Operations p. 156 Integer Arithmetic p. 156 Floating-Point Arithmetic p. 156 Strict and non-strict Floating-Point Arithmetic p. 158 General Operators p. 159 Increment and Decrement Operators p. 159 Relational and Equality Operators p. 160 Logical Operators p. 161 instanceof p. 162 Bit Manipulation Operators p. 163 The Conditional Operator?: p. 164 Assignment Operators p. 165 String Concatenation Operator p. 167 new p. 167 Expressions p. 168 Order of Evaluation p. 168 Expression Type p. 169 Implicit Type Conversions p. 169 Explicit Type Casts p. 171 String Conversions p. 172 Member Access p. 173 Finding the Right Method p. 173 Operator Precedence and Associativity p. 176 Control Flow p. 179 Statements and Blocks p. 179 if-else p. 180 switch p. 182 while and do-while p. 185 for p. 186 Labels p. 189 break p. 189 continue p. 192 return p. 193 What, No goto? p. 193
Exceptions p. 195 Creating Exception Types p. 196 throw p. 197 Transfer of Control p. 198 Asynchronous Exceptions p. 198 The throws Clause p. 199 throws Clauses and Method Overriding p. 200 throws Clauses and Native Methods p. 201 try, catch, and finally p. 202 finally p. 204 When to Use Exceptions p. 206 Strings p. 209 Basic String Operations p. 209 String Comparisons p. 211 String Literal Equivalence p. 214 Utility Methods p. 215 Making Related Strings p. 215 String Conversions p. 217 Strings and char Arrays p. 218 Strings and byte Arrays p. 220 Character Encodings p. 221 The StringBuffer Class p. 222 Modifying the Buffer p. 223 Getting Data Out p. 225 Capacity Management p. 226 Threads p. 227 Creating Threads p. 229 Using Runnable p. 231 Synchronization p. 235 synchronized Methods p. 235 Static Synchronized Methods p. 238 synchronized Statements p. 238 Synchronization Designs p. 242 wait, notifyall, and notify p. 244 Details of Waiting and Notification p. 246 Thread Scheduling p. 248 Voluntary Rescheduling p. 249 Deadlocks p. 252 Ending Thread Execution p. 254 Cancelling a Thread p. 255 Waiting for a Thread to Complete p. 257
Ending Application Execution p. 259 volatile p. 260 Thread Management, Security and ThreadGroup p. 261 Threads and Exceptions p. 266 Don't stop p. 266 ThreadLocal Variables p. 267 Debugging Threads p. 269 Programming with Types p. 271 Wrapper Classes p. 272 Void p. 274 Boolean p. 274 Character p. 275 Number p. 279 The Integer Wrappers p. 279 The Floating-Point Wrapper Classes p. 281 Reflection p. 282 The Class class p. 283 Naming Classes p. 287 Examining Class Members p. 288 The Modifier Class p. 292 The Field Class p. 292 The Method Class p. 294 Creating New Objects and the Constructor Class p. 296 Access Checking and AccessibleObject p. 299 Arrays p. 299 Packages p. 301 The Proxy Class p. 301 Loading Classes p. 304 The ClassLoader Class p. 307 Preparing a Class for use p. 309 Loading Related Resources p. 310 Garbage Collection and Memory p. 313 Garbage Collection p. 313 A Simple Model p. 314 Finalization p. 316 Resurrecting Objects during finalize p. 318 Interacting with the Garbage Collector p. 318 Reachability States and Reference Objects p. 320 The Reference Class p. 321 Strengths of Reference and Reachability p. 321 Reference Queues p. 325
Packages p. 329 Package Naming p. 330 Type Imports p. 331 Package Access p. 332 Accessibility and Overriding Methods p. 333 Package Contents p. 336 Package Objects and Specifications p. 337 Documentation Comments p. 341 The Anatomy of a Doc Comment p. 342 Tags p. 343 @see p. 343 {@link} p. 344 @param p. 345 @return p. 345 @throws and @exception p. 345 @deprecated p. 345 @author p. 346 @version p. 346 @since p. 346 {@docroot} p. 347 An Example p. 347 External Conventions p. 352 Overview and Package Documentation p. 352 The doc-files Directory p. 353 Notes on Usage p. 353 The I/O Package p. 355 Byte Streams p. 357 InputStream p. 357 OutputStream p. 360 Character Streams p. 362 Reader p. 363 Writer p. 366 Character Streams and the Standard Streams p. 367 InputStreamReader and OutputStreamWriter p. 367 A Quick Tour of The Stream Classes p. 369 Synchronization and Concurrency p. 370 Filter Streams p. 371 Buffered Streams p. 374 Piped Streams p. 375 ByteArray Byte Streams p. 377 CharArray Character Streams p. 378
String Character Streams p. 379 Print Streams p. 380 LineNumberReader p. 381 SequenceInputStream p. 383 Pushback Streams p. 384 StreamTokenizer p. 386 The Data Byte Streams p. 391 DataInput and DataOutput p. 392 The Data Stream Classes p. 393 Working with Files p. 395 File Streams and FileDescriptor p. 395 RandomAccessFile p. 396 The File Class p. 398 FilenameFilter and FileFilter p. 404 Object Serialization p. 405 The Object Byte Streams p. 405 Making Your Classes Serializable p. 406 Serialization and Deserialization Order p. 408 Customized Serialization p. 409 Object Versioning p. 413 Serialized Fields p. 414 The Externalizable Interface p. 416 Documentation Comment Tags p. 417 The IOException Classes p. 418 Collections p. 421 Collections p. 421 Exception Conventions p. 424 Iteration p. 425 Ordering using Comparable and Comparator p. 427 The Collection Interface p. 428 Set and SortedSet p. 430 HashSet p. 432 TreeSet p. 432 List p. 433 ArrayList p. 435 LinkedList p. 436 Map and SortedMap p. 437 HashMap p. 440 TreeMap p. 441 WeakHashMap p. 442 Wrapped Collections and the Collections Class p. 442
The Synchronization Wrappers p. 443 The Unmodifiable Wrappers p. 444 The Collections Utilities p. 445 The Arrays Utility Class p. 448 Writing Iterator Implementations p. 448 Writing Collection Implementations p. 451 The Legacy Collection Types p. 456 Enumeration p. 457 Vector p. 457 Stack p. 459 Dictionary p. 459 Hashtable p. 460 Properties p. 460 Miscellaneous Utilities p. 463 BitSet p. 464 Observer/Observable p. 466 Random p. 470 StringTokenizer p. 472 Timer and TimerTask p. 473 Math and StrictMath p. 477 System Programming p. 479 The System Class p. 480 Standard I/O Streams p. 480 System Properties p. 481 Utility Methods p. 483 Creating Processes p. 484 The Process Class p. 485 Process Environments p. 487 Portability p. 488 Shutdown p. 488 Shutdown Hooks p. 489 The Shutdown Sequence p. 490 Shutdown Strategies p. 491 The Rest of the Runtime p. 492 Loading Native Code p. 492 Debugging p. 493 Security p. 493 The SecurityManager Class p. 494 Permissions p. 496 Security Policies p. 497 Access Controllers and Privileged Execution p. 497
Internationalization and Localization p. 501 Locale p. 502 Resource Bundles p. 504 ListResourceBundle p. 507 PropertyResourceBundle p. 508 Subclassing ResourceBundle p. 509 Time, Dates, and Calendars p. 509 Calendars p. 510 Time Zones p. 514 GregorianCalendar and SimpleTimeZone p. 515 Formatting and Parsing Dates and Times p. 517 Internationalization and Localization for Text p. 520 Collation p. 520 Formatting and Parsing p. 522 Text Boundaries p. 524 Standard Packages p. 527 java.awt--the Abstract Window Toolkit p. 529 java.applet--applets p. 532 java.beans--components p. 533 java.math--mathematics p. 534 java.net--the Network p. 535 java.rmi--remote Method Invocation p. 538 java.security--security Tools p. 543 java.sql--relational Database Access p. 544 Utility Subpackages p. 544 Archive Files--java.util.jar p. 544 ZIP Files--java.util.zip p. 545 javax.*--standard Extensions p. 546 javax.accessibility--accessibility for GUIs p. 546 javax.naming--directory and Naming Services p. 547 javax.sound--sound Manipulation p. 548 javax.swing--swing GUI Components p. 549 org.omg.corba--corba APIs p. 549 Runtime Exceptions p. 551 RuntimeException Classes p. 552 Error Classes p. 554 Useful Tables p. 557 Keywords p. 557 Operator Precedence p. 558 Unicode Digits p. 558 Unicode Letters and Digits p. 559
Special Characters Using p. 560 Documentation Comment Tags p. 560 Unicode Character Blocks p. 561 Further Reading p. 563 Index p. 569 Table of Contents provided by Blackwell's Book Services and R.R. Bowker. Used with permission.