gogogo
Syndetics cover image
Image from Syndetics

The Java programming language / Ken Arnold, James Gosling, David Holmes.

By: Contributor(s): Material type: TextTextSeries: The Java seriesPublication details: Boston : Addison-Wesley, c2000.Edition: 3rd edDescription: xxiv, 672 p. ; 24 cmISBN:
  • 0201704331
  • 9780201704334
Subject(s): DDC classification:
  • 005.133 ARN
Holdings
Item type Current library Call number Copy number Status Date due Barcode
Standard Loan Moylish Library Main Collection 005.133 ARN (Browse shelf(Opens below)) 1 Available 39002100345959
Standard Loan Thurles Library Main Collection 005.133 ARN (Browse shelf(Opens below)) Available R05278JKRCT

Enhanced descriptions from Syndetics:

Direct from the creators of the Java programming language, this Third Edition of The Java Programming Language is a valuable resource for both novice and advanced programmers. More than 100,000 developers who programmed with C, C++, Smalltalk, or other high-level languages have used this book to get a concise, intelligent, and deep understanding of the Java programming language. This book is what you need to understand the basic design goals of the language and the application of the language in real-world development. It provides unique insights into why and how the language was designed and intended to be used. The authors describe the latest version of the language, as defined in the Java Language Specification, Second Edition and implemented in version 1.3 of the Java 2 SDK, Standard Edition. This third edition has been structured to give more in-depth treatment of the newer language features, as well as informative examples on using some of the new APIs. New and/or revised in this edition: *more details on language features, including an expanded section on nested classes *more comprehensive treatment of garbage collection and related programming issues *coverage of new APIs,

Includes bibliographical references (p. 563-567) and index.

Table of contents provided by Syndetics

  • 1 A Quick Tour (p. 1)
  • 1.1 Getting Started (p. 1)
  • 1.2 Variables (p. 3)
  • 1.3 Comments in Code (p. 6)
  • 1.4 Named Constants (p. 6)
  • 1.5 Unicode Characters (p. 8)
  • 1.6 Flow of Control (p. 9)
  • 1.7 Classes and Objects (p. 11)
  • 1.7.1 Creating Objects (p. 12)
  • 1.7.2 Static or Class Fields (p. 13)
  • 1.7.3 The Garbage Collector (p. 14)
  • 1.8 Methods and Parameters (p. 14)
  • 1.8.1 Invoking a Method (p. 15)
  • 1.8.2 The this Reference (p. 16)
  • 1.8.3 Static or Class Methods (p. 17)
  • 1.9 Arrays (p. 17)
  • 1.10 String Objects (p. 20)
  • 1.11 Extending a Class (p. 22)
  • 1.11.1 Invoking Methods from the Superclass (p. 23)
  • 1.11.2 The Object Class (p. 24)
  • 1.11.3 Type Casting (p. 25)
  • 1.12 Interfaces (p. 25)
  • 1.13 Exceptions (p. 27)
  • 1.14 Packages (p. 30)
  • 1.15 The Java Platform (p. 32)
  • 1.16 Other Topics Briefly Noted (p. 33)
  • 2 Classes and Objects (p. 35)
  • 2.1 A Simple Class (p. 36)
  • 2.1.1 Class Members (p. 36)
  • 2.1.2 Class Modifiers (p. 37)
  • 2.2 Fields (p. 38)
  • 2.2.1 Field Initialization (p. 38)
  • 2.2.2 Static Fields (p. 39)
  • 2.2.3 final Fields (p. 40)
  • 2.3 Access Control (p. 41)
  • 2.4 Creating Objects (p. 42)
  • 2.5 Construction and Initialization (p. 43)
  • 2.5.1 Constructors (p. 44)
  • 2.5.2 Initialization Blocks (p. 48)
  • 2.5.3 Static Initialization (p. 49)
  • 2.6 Methods (p. 50)
  • 2.6.1 Static Methods (p. 51)
  • 2.6.2 Method Invocations (p. 51)
  • 2.6.3 Method Execution and Return (p. 53)
  • 2.6.4 Parameter Values (p. 54)
  • 2.6.5 Using Methods to Control Access (p. 57)
  • 2.7 this (p. 59)
  • 2.8 Overloading Methods (p. 61)
  • 2.9 The main Method (p. 62)
  • 2.10 Native Methods (p. 63)
  • 3 Extending Classes (p. 65)
  • 3.1 An Extended Class (p. 66)
  • 3.2 Constructors in Extended Classes (p. 69)
  • 3.2.1 Constructor Order Dependencies (p. 71)
  • 3.3 Inheriting and Redefining Members (p. 73)
  • 3.3.1 Overriding (p. 73)
  • 3.3.2 Hiding Fields (p. 74)
  • 3.3.3 Accessing Inherited Members (p. 75)
  • 3.3.4 Accessibility and Overriding (p. 77)
  • 3.3.5 Hiding Static Members (p. 77)
  • 3.3.6 The super Keyword (p. 78)
  • 3.4 Type Compatibility and Conversion (p. 79)
  • 3.4.1 Compatibility (p. 79)
  • 3.4.2 Explicit Type Casting (p. 80)
  • 3.4.3 Testing for Type (p. 80)
  • 3.5 What protected Really Means (p. 81)
  • 3.6 Marking Methods and Classes final (p. 84)
  • 3.7 Abstract Classes and Methods (p. 85)
  • 3.8 The Object Class (p. 87)
  • 3.9 Cloning Objects (p. 89)
  • 3.9.1 Strategies for Cloning (p. 89)
  • 3.9.2 Correct Cloning (p. 91)
  • 3.9.3 Shallow versus Deep Cloning (p. 94)
  • 3.10 Extending Classes: How and When (p. 95)
  • 3.11 Designing a Class to Be Extended (p. 96)
  • 3.11.1 Designing an Extensible Framework (p. 97)
  • 3.12 Single Inheritance versus Multiple Inheritance (p. 102)
  • 4 Interfaces (p. 105)
  • 4.1 A Simple Interface Example (p. 106)
  • 4.2 Interface Declarations (p. 108)
  • 4.2.1 Interface Constants (p. 109)
  • 4.2.2 Interface Methods (p. 109)
  • 4.2.3 Interface Modifiers (p. 110)
  • 4.3 Extending Interfaces (p. 110)
  • 4.3.1 Inheriting and Hiding Constants (p. 111)
  • 4.3.2 Inheriting, Overriding, and Overloading Methods (p. 112)
  • 4.4 Working with Interfaces (p. 113)
  • 4.4.1 Implementing Interfaces (p. 114)
  • 4.4.2 Using an Implementation (p. 116)
  • 4.5 Marker Interfaces (p. 117)
  • 4.6 When to Use Interfaces (p. 118)
  • 5 Nested Classes and Interfaces (p. 121)
  • 5.1 Static Nested Types (p. 121)
  • 5.1.1 Static Nested Classes (p. 122)
  • 5.1.2 Nested Interfaces (p. 123)
  • 5.2 Inner Classes (p. 123)
  • 5.2.1 Accessing Enclosing Objects (p. 125)
  • 5.2.2 Extending Inner Classes (p. 126)
  • 5.2.3 Inheritance, Scoping, and Hiding (p. 127)
  • 5.3 Local Inner Classes (p. 129)
  • 5.4 Anonymous Inner Classes (p. 131)
  • 5.5 Inheriting Nested Types (p. 132)
  • 5.6 Nesting in Interfaces (p. 134)
  • 5.6.1 Modifiable Variables in Interfaces (p. 135)
  • 5.7 Implementation of Nested Types (p. 136)
  • 6 Tokens, Operators, and Expressions (p. 137)
  • 6.1 Lexical Elements (p. 137)
  • 6.1.1 Character Set (p. 138)
  • 6.1.2 Comments (p. 138)
  • 6.1.3 Tokens (p. 139)
  • 6.1.4 Identifiers (p. 140)
  • 6.1.5 Keywords (p. 141)
  • 6.2 Types and Literals (p. 141)
  • 6.2.1 Reference Literals (p. 142)
  • 6.2.2 Boolean Literals (p. 142)
  • 6.2.3 Character Literals (p. 142)
  • 6.2.4 Integer Literals (p. 143)
  • 6.2.5 Floating-Point Literals (p. 143)
  • 6.2.6 String Literals (p. 144)
  • 6.2.7 Class Literals (p. 144)
  • 6.3 Variables (p. 144)
  • 6.3.1 Field and Local Variable Declarations (p. 145)
  • 6.3.2 Parameter Variables (p. 146)
  • 6.3.3 final Variables (p. 146)
  • 6.4 Array Variables (p. 148)
  • 6.4.1 Array Modifiers (p. 149)
  • 6.4.2 Arrays of Arrays (p. 149)
  • 6.4.3 Array Initialization (p. 150)
  • 6.4.4 Arrays and Types (p. 151)
  • 6.5 The Meanings of Names (p. 152)
  • 6.6 Arithmetic Operations (p. 156)
  • 6.6.1 Integer Arithmetic (p. 156)
  • 6.6.2 Floating-Point Arithmetic (p. 156)
  • 6.6.3 Strict and non-Strict Floating-Point Arithmetic (p. 158)
  • 6.7 General Operators (p. 159)
  • 6.7.1 Increment and Decrement Operators (p. 159)
  • 6.7.2 Relational and Equality Operators (p. 160)
  • 6.7.3 Logical Operators (p. 161)
  • 6.7.4 instanceof (p. 162)
  • 6.7.5 Bit Manipulation Operators (p. 163)
  • 6.7.6 The Conditional Operator ?: (p. 164)
  • 6.7.7 Assignment Operators (p. 165)
  • 6.7.8 String Concatenation Operator (p. 167)
  • 6.7.9 new (p. 167)
  • 6.8 Expressions (p. 168)
  • 6.8.1 Order of Evaluation (p. 168)
  • 6.8.2 Expression Type (p. 169)
  • 6.8.3 Implicit Type Conversions (p. 169)
  • 6.8.4 Explicit Type Casts (p. 171)
  • 6.8.5 String Conversions (p. 172)
  • 6.9 Member Access (p. 173)
  • 6.9.1 Finding the Right Method (p. 173)
  • 6.10 Operator Precedence and Associativity (p. 176)
  • 7 Control Flow (p. 179)
  • 7.1 Statements and Blocks (p. 179)
  • 7.2 if-else (p. 180)
  • 7.3 switch (p. 182)
  • 7.4 while and do-while (p. 185)
  • 7.5 for (p. 186)
  • 7.6 Labels (p. 189)
  • 7.7 break (p. 189)
  • 7.8 continue (p. 192)
  • 7.9 return (p. 193)
  • 7.10 What, No goto? (p. 193)
  • 8 Exceptions (p. 195)
  • 8.1 Creating Exception Types (p. 196)
  • 8.2 throw (p. 197)
  • 8.2.1 Transfer of Control (p. 198)
  • 8.2.2 Asynchronous Exceptions (p. 198)
  • 8.3 The throws Clause (p. 199)
  • 8.3.1 throws Clauses and Method Overriding (p. 200)
  • 8.3.2 throws Clauses and Native Methods (p. 201)
  • 8.4 try, catch, and finally (p. 202)
  • 8.4.1 finally (p. 204)
  • 8.5 When to Use Exceptions (p. 206)
  • 9 Strings (p. 209)
  • 9.1 Basic String Operations (p. 209)
  • 9.2 String Comparisons (p. 211)
  • 9.2.1 String Literal Equivalence (p. 214)
  • 9.3 Utility Methods (p. 215)
  • 9.4 Making Related Strings (p. 215)
  • 9.5 String Conversions (p. 217)
  • 9.6 Strings and char Arrays (p. 218)
  • 9.7 Strings and byte Arrays (p. 220)
  • 9.7.1 Character Encodings (p. 221)
  • 9.8 The StringBuffer Class (p. 222)
  • 9.8.1 Modifying the Buffer (p. 223)
  • 9.8.2 Getting Data Out (p. 225)
  • 9.8.3 Capacity Management (p. 226)
  • 10 Threads (p. 227)
  • 10.1 Creating Threads (p. 229)
  • 10.2 Using Runnable (p. 231)
  • 10.3 Synchronization (p. 235)
  • 10.3.1 synchronized Methods (p. 235)
  • 10.3.2 Static Synchronized Methods (p. 238)
  • 10.3.3 synchronized Statements (p. 238)
  • 10.3.4 Synchronization Designs (p. 242)
  • 10.4 wait, notifyAll, and notify (p. 244)
  • 10.5 Details of Waiting and Notification (p. 246)
  • 10.6 Thread Scheduling (p. 248)
  • 10.6.1 Voluntary Rescheduling (p. 249)
  • 10.7 Deadlocks (p. 252)
  • 10.8 Ending Thread Execution (p. 254)
  • 10.8.1 Cancelling a Thread (p. 255)
  • 10.8.2 Waiting for a Thread to Complete (p. 257)
  • 10.9 Ending Application Execution (p. 259)
  • 10.10 volatile (p. 260)
  • 10.11 Thread Management, Security and ThreadGroup (p. 261)
  • 10.12 Threads and Exceptions (p. 266)
  • 10.12.1 Don't stop (p. 266)
  • 10.13 ThreadLocal Variables (p. 267)
  • 10.14 Debugging Threads (p. 269)
  • 11 Programming with Types (p. 271)
  • 11.1 Wrapper Classes (p. 272)
  • 11.1.1 Void (p. 274)
  • 11.1.2 Boolean (p. 274)
  • 11.1.3 Character (p. 275)
  • 11.1.4 Number (p. 279)
  • 11.1.5 The Integer Wrappers (p. 279)
  • 11.1.6 The Floating-Point Wrapper Classes (p. 281)
  • 11.2 Reflection (p. 282)
  • 11.2.1 The Class class (p. 283)
  • 11.2.2 Naming Classes (p. 287)
  • 11.2.3 Examining Class Members (p. 288)
  • 11.2.4 The Modifier Class (p. 292)
  • 11.2.5 The Field Class (p. 292)
  • 11.2.6 The Method Class (p. 294)
  • 11.2.7 Creating New Objects and the Constructor Class (p. 296)
  • 11.2.8 Access Checking and AccessibleObject (p. 299)
  • 11.2.9 Arrays (p. 299)
  • 11.2.10 Packages (p. 301)
  • 11.2.11 The Proxy Class (p. 301)
  • 11.3 Loading Classes (p. 304)
  • 11.3.1 The ClassLoader Class (p. 307)
  • 11.3.2 Preparing a Class for use (p. 309)
  • 11.3.3 Loading Related Resources (p. 310)
  • 12 Garbage Collection and Memory (p. 313)
  • 12.1 Garbage Collection (p. 313)
  • 12.2 A Simple Model (p. 314)
  • 12.3 Finalization (p. 316)
  • 12.3.1 Resurrecting Objects during finalize (p. 318)
  • 12.4 Interacting with the Garbage Collector (p. 318)
  • 12.5 Reachability States and Reference Objects (p. 320)
  • 12.5.1 The Reference Class (p. 321)
  • 12.5.2 Strengths of Reference and Reachability (p. 321)
  • 12.5.3 Reference Queues (p. 325)
  • 13 Packages (p. 329)
  • 13.1 Package Naming (p. 330)
  • 13.2 Type Imports (p. 331)
  • 13.3 Package Access (p. 332)
  • 13.3.1 Accessibility and Overriding Methods (p. 333)
  • 13.4 Package Contents (p. 336)
  • 13.5 Package Objects and Specifications (p. 337)
  • 14 Documentation Comments (p. 341)
  • 14.1 The Anatomy of a Doc Comment (p. 342)
  • 14.2 Tags (p. 343)
  • 14.2.1 @see (p. 343)
  • 14.2.2 {{@link}} (p. 344)
  • 14.2.3 @param (p. 345)
  • 14.2.4 @return (p. 345)
  • 14.2.5 @throws and @exception (p. 345)
  • 14.2.6 @deprecated (p. 345)
  • 14.2.7 @author (p. 346)
  • 14.2.8 @version (p. 346)
  • 14.2.9 @since (p. 346)
  • 14.2.10 {{@docRoot}} (p. 347)
  • 14.3 An Example (p. 347)
  • 14.4 External Conventions (p. 352)
  • 14.4.1 Overview and Package Documentation (p. 352)
  • 14.4.2 The doc-files Directory (p. 353)
  • 14.5 Notes on Usage (p. 353)
  • 15 The I/O Package (p. 355)
  • 15.1 Byte Streams (p. 357)
  • 15.1.1 InputStream (p. 357)
  • 15.1.2 OutputStream (p. 360)
  • 15.2 Character Streams (p. 362)
  • 15.2.1 Reader (p. 363)
  • 15.2.2 Writer (p. 366)
  • 15.2.3 Character Streams and the Standard Streams (p. 367)
  • 15.3 InputStreamReader and OutputStreamWriter (p. 367)
  • 15.4 A Quick Tour of The Stream Classes (p. 369)
  • 15.4.1 Synchronization and Concurrency (p. 370)
  • 15.4.2 Filter Streams (p. 371)
  • 15.4.3 Buffered Streams (p. 374)
  • 15.4.4 Piped Streams (p. 375)
  • 15.4.5 ByteArray Byte Streams (p. 377)
  • 15.4.6 CharArray Character Streams (p. 378)
  • 15.4.7 String Character Streams (p. 379)
  • 15.4.8 Print Streams (p. 380)
  • 15.4.9 LineNumberReader (p. 381)
  • 15.4.10 SequenceInputStream (p. 383)
  • 15.4.11 Pushback Streams (p. 384)
  • 15.4.12 StreamTokenizer (p. 386)
  • 15.5 The Data Byte Streams (p. 391)
  • 15.5.1 DataInput and DataOutput (p. 392)
  • 15.5.2 The Data Stream Classes (p. 393)
  • 15.6 Working with Files (p. 395)
  • 15.6.1 File Streams and FileDescriptor (p. 395)
  • 15.6.2 RandomAccessFile (p. 396)
  • 15.6.3 The File Class (p. 398)
  • 15.6.4 FilenameFilter and FileFilter (p. 404)
  • 15.7 Object Serialization (p. 405)
  • 15.7.1 The Object Byte Streams (p. 405)
  • 15.7.2 Making Your Classes Serializable (p. 406)
  • 15.7.3 Serialization and Deserialization Order (p. 408)
  • 15.7.4 Customized Serialization (p. 409)
  • 15.7.5 Object Versioning (p. 413)
  • 15.7.6 Serialized Fields (p. 414)
  • 15.7.7 The Externalizable Interface (p. 416)
  • 15.7.8 Documentation Comment Tags (p. 417)
  • 15.8 The IOException Classes (p. 418)
  • 16 Collections (p. 421)
  • 16.1 Collections (p. 421)
  • 16.1.1 Exception Conventions (p. 424)
  • 16.2 Iteration (p. 425)
  • 16.3 Ordering using Comparable and Comparator (p. 427)
  • 16.4 The Collection Interface (p. 428)
  • 16.5 Set and SortedSet (p. 430)
  • 16.5.1 HashSet (p. 432)
  • 16.5.2 TreeSet (p. 432)
  • 16.6 List (p. 433)
  • 16.6.1 ArrayList (p. 435)
  • 16.6.2 LinkedList (p. 436)
  • 16.7 Map and SortedMap (p. 437)
  • 16.7.1 HashMap (p. 440)
  • 16.7.2 TreeMap (p. 441)
  • 16.7.3 WeakHashMap (p. 442)
  • 16.8 Wrapped Collections and the Collections Class (p. 442)
  • 16.8.1 The Synchronization Wrappers (p. 443)
  • 16.8.2 The Unmodifiable Wrappers (p. 444)
  • 16.8.3 The Collections Utilities (p. 445)
  • 16.9 The Arrays Utility Class (p. 448)
  • 16.10 Writing Iterator Implementations (p. 448)
  • 16.11 Writing Collection Implementations (p. 451)
  • 16.12 The Legacy Collection Types (p. 456)
  • 16.12.1 Enumeration (p. 457)
  • 16.12.2 Vector (p. 457)
  • 16.12.3 Stack (p. 459)
  • 16.12.4 Dictionary (p. 459)
  • 16.12.5 Hashtable (p. 460)
  • 16.13 Properties (p. 460)
  • 17 Miscellaneous Utilities (p. 463)
  • 17.1 BitSet (p. 464)
  • 17.2 Observer/Observable (p. 466)
  • 17.3 Random (p. 470)
  • 17.4 StringTokenizer (p. 472)
  • 17.5 Timer and TimerTask (p. 473)
  • 17.6 Math and StrictMath (p. 477)
  • 18 System Programming (p. 479)
  • 18.1 The System Class (p. 480)
  • 18.1.1 Standard I/O Streams (p. 480)
  • 18.1.2 System Properties (p. 481)
  • 18.1.3 Utility Methods (p. 483)
  • 18.2 Creating Processes (p. 484)
  • 18.2.1 The Process Class (p. 485)
  • 18.2.2 Process Environments (p. 487)
  • 18.2.3 Portability (p. 488)
  • 18.3 Shutdown (p. 488)
  • 18.3.1 Shutdown Hooks (p. 489)
  • 18.3.2 The Shutdown Sequence (p. 490)
  • 18.3.3 Shutdown Strategies (p. 491)
  • 18.4 The Rest of the Runtime (p. 492)
  • 18.4.1 Loading Native Code (p. 492)
  • 18.4.2 Debugging (p. 493)
  • 18.5 Security (p. 493)
  • 18.5.1 The SecurityManager Class (p. 494)
  • 18.5.2 Permissions (p. 496)
  • 18.5.3 Security Policies (p. 497)
  • 18.5.4 Access Controllers and Privileged Execution (p. 497)
  • 19 Internationalization and Localization (p. 501)
  • 19.1 Locale (p. 502)
  • 19.2 Resource Bundles (p. 504)
  • 19.2.1 ListResourceBundle (p. 507)
  • 19.2.2 PropertyResourceBundle (p. 508)
  • 19.2.3 Subclassing ResourceBundle (p. 509)
  • 19.3 Time, Dates, and Calendars (p. 509)
  • 19.3.1 Calendars (p. 510)
  • 19.3.2 Time Zones (p. 514)
  • 19.3.3 GregorianCalendar and SimpleTimeZone (p. 515)
  • 19.4 Formatting and Parsing Dates and Times (p. 517)
  • 19.5 Internationalization and Localization for Text (p. 520)
  • 19.5.1 Collation (p. 520)
  • 19.5.2 Formatting and Parsing (p. 522)
  • 19.5.3 Text Boundaries (p. 524)
  • 20 Standard Packages (p. 527)
  • 20.1 java.awt--The Abstract Window Toolkit (p. 529)
  • 20.2 java.applet--Applets (p. 532)
  • 20.3 java.beans--Components (p. 533)
  • 20.4 java.math--Mathematics (p. 534)
  • 20.5 java.net--The Network (p. 535)
  • 20.6 java.rmi--Remote Method Invocation (p. 538)
  • 20.7 java.security--Security Tools (p. 543)
  • 20.8 java.sql--Relational Database Access (p. 544)
  • 20.9 Utility Subpackages (p. 544)
  • 20.9.1 Archive Files--java.util.jar (p. 544)
  • 20.9.2 ZIP Files--java.util.zip (p. 545)
  • 20.10 javax.*--Standard Extensions (p. 546)
  • 20.11 javax.accessibility--Accessibility for GUIs (p. 546)
  • 20.12 javax.naming--Directory and Naming Services (p. 547)
  • 20.13 javax.sound--Sound Manipulation (p. 548)
  • 20.14 javax.swing--Swing GUI Components (p. 549)
  • 20.15 org.omg.CORBA--CORBA APIs (p. 549)
  • A Runtime Exceptions (p. 551)
  • A.1 RuntimeException Classes (p. 552)
  • A.2 Error Classes (p. 554)
  • B Useful Tables (p. 557)
  • Table 1 Keywords (p. 557)
  • Table 2 Operator Precedence (p. 558)
  • Table 3 Unicode Digits (p. 558)
  • Table 4 Unicode Letters and Digits (p. 559)
  • Table 5 Special Characters Using (p. 560)
  • Table 6 Documentation Comment Tags (p. 560)
  • Table 7 Unicode Character Blocks (p. 561)
  • Further Reading (p. 563)
  • Index (p. 569)

Excerpt provided by Syndetics

Beautiful buildings are more than scientific. They are true organisms,spiritually conceived; works of art, using the best technology by inspiration rather than the idiosyncrasies of mere taste or any averaging by the committee mind. --Frank Lloyd Wright The Java™ programming language has been warmly received by the world community of software developers and Internet content providers. Users of the Internet and World Wide Web benefit from access to secure, platform-independent applications that can come from anywhere on the Internet. Software developers who create applications in the Java programming language benefit by developing code only once, with no need to "port" their applications to every software and hardware platform. For many, the language was known first as a tool to create applets for the World Wide Web. An applet is a mini-application that runs inside a Web page. An applet can perform tasks and interact with users on their browser pages without using resources from the Web server after being downloaded. Some applets may, of course, talk with the server to do their job, but that's their business. The Java programming language is indeed valuable for distributed network environments like the Web. However, it goes well beyond this domain to provide a powerful general-purpose programming language suitable for building a variety of applications that either do not depend on network features or want them for different reasons. The ability to execute downloaded code on remote hosts in a secure manner is a critical requirement for many organizations. Other groups use it as a general-purpose programming language for projects in which machine independence is less important. Ease of programming and safety features help you quickly produce working code. Some common programming errors never occur because of features like garbage collection and type-safe references. Support for multithreading caters to modern network-based and graphical user interface-based applications that must attend to multiple tasks simultaneously, and the mechanisms of exception handling ease the task of dealing with error conditions. While the built-in tools are powerful, it is a simple language in which programmers can quickly become proficient. The Java programming language is designed for maximum portability with as few implementation dependencies as possible. An int, for example, is a 32-bit signed two's-complement integer in all implementations, irrespective of the CPU architecture on which the program executes. Defining everything possible about the language and its runtime environment enables users to run compiled code anywhere and share code with anyone who has a Java runtime environment. About This Book This book teaches the Java programming language to people who are familiar with basic programming concepts. It explains the language without being arduously formal or complete. This book is not an introduction to object-oriented programming, although some issues are covered to establish a common terminology. Other books in this series and much online documentation focus on applets, graphical interfaces, Web sites, databases, components, and other specific kinds of programming tasks. For other references, see "Further Reading" on page 755. This fourth edition provides integrated coverage of the Java programming language as provided by the Java™ 2 Platform Standard Edition 5.0 and specified by the Java™ Language Specification, Third Edition. It also covers most of the classes in the main packages (java.lang, java.util, java.io) as implemented in the J2SE™ Development Kit 5.0 (more commonly known as JDK 5.0, or in the older nomenclature JDK 1.5.0). If you have already read the third edition of this book, you will find some major changes, both in the language and the book, since the 1.3 release that the third edition covered. There are new chapters on generics, enums, and annotations--the major new language features introduced in the 5.0 release--and major new sections on assertions and regular expressions. Some existing material has been restructured to accommodate other changes and to improve the general flow of the text--such as introducing the new boxing and unboxing conversions. But every single chapter has been updated in some way, whether it is a new language feature like variable argument methods; the new enhanced for loop construct; a new class such as Formatter for formatting text output; or changes to classes and methods caused by the addition of generics (such as the collections utilities and the reflection classes)--change permeates this entire fourth edition. The Java programming language shares many features common to most programming languages in use today. The language should look familiar to C and C++ programmers because it was designed with C and C++ constructs where the languages are similar. That said, this book is neither a comparative analysis nor a "bridge" tutorial--no knowledge of C or C++ is assumed. C++ programmers, especially, may be as hindered by what they must unlearn as they are helped by their knowledge. Chapter 1-- A Quick Tour --gives a quick overview of the language. Programmers who are unfamiliar with object-oriented programming notions should read the quick tour, while programmers who are already familiar with object-oriented programming paradigms will find the quick tour a useful introduction to the object-oriented features of the language. The quick tour introduces some of the basic language features on which examples through the rest of the book are built. Chapters 2 through 6 cover the object-oriented core features of the language, namely, class declarations that define components of a program, and objects manufactured according to class definitions. Chapter 2-- Classes and Objects --describes the basis of the language: classes. Chapter 3-- Extending Classes --describes how an existing class can be extended, or subclassed, to create a new class with additional data and behavior. Chapter 4-- Interfaces --describes how to declare interface types that are abstract descriptions of behavior that provide maximum flexibility for class designers and implementors. Chapter 5-- Nested Classes and Interfaces --describes how classes and interfaces can be declared inside other classes and interfaces, and the benefits that provides. Finally, Chapter 6-- Enumeration Types --covers the definition and use of type-safe enumeration constants. Chapters 7 through 10 cover standard constructs common to most languages. Chapter 7-- Tokens, Values, and Variables --describes the tokens of the language from which statements are constructed, the types defined by the language and their allowed values, and the variables that store data in objects, arrays, or locally within methods. Chapter 8-- Primitives as Types --explores the relationship between the primitive types and objects of their corresponding wrapper classes, and how boxing and unboxing can transparently convert between them. Chapter 9-- Operators and Expressions --describes the basic operators of the language, how these operators are used to build expressions, and how expressions are evaluated. Chapter 10-- Control Flow --describes how control statements direct the order of statement execution. Chapter 11-- Generic Types --describes generic types: how they are written and used, their power, and their limitations. Chapter 12-- Exceptions and Assertions --describes the language's powerful error-handling capabilities, and the use of assertions to validate the expected behavior of code. Chapter 13-- Strings and Regular Expressions --describes the built-in language and runtime support for String objects, the underlying character set support, and the powerful utilities for regular expression matching. Chapter 14-- Threads --explains the language's view of multithreading. Many applications, such as graphical interface-based software, must attend to multiple tasks simultaneously. These tasks must cooperate to behave correctly, and threads meet the needs of cooperative multitasking. Chapter 15-- Annotations --describes the annotation types used to document some of the extra-linguistic properties of classes and method. Chapter 16-- Reflection --describes the runtime type introspection mechanism and how you can construct and manipulate objects of unknown type dynamically at runtime. Chapter 17-- Garbage Collection and Memory --talks about garbage collection, finalization, and lower-strength reference objects. Chapter 18-- Packages --describes how you can group collections of classes and interfaces into separate packages. Chapter 19-- Documentation Comments --shows how to write reference documentation in comments. Chapters 20 through 24 cover the main packages. Chapter 20-- The I/O Package --describes the input/output system, which is based on streams. Chapter 21-- Collections --covers the collection or container classes such as sets and lists. Chapter 22-- Miscellaneous Utilities --covers the rest of the utility classes such as bit sets, formatted output, text scanning, and random number generation. Chapter 23-- System Programming --leads you through the system classes that provide access to features of the underlying platform. Chapter 24-- Internationalization and Localization --covers some of the tools used to create programs that can run in many linguistic and cultural environments. Chapter 25-- Standard Packages --briefly explores the packages that are part of the standard platform, giving overviews of those packages not covered in more detail in this book. Appendix A-- Application Evolution --looks at some of the issues involved in dealing with the evolution of applications and the Java platform, and the impact this has on some of the new language features. Appendix B-- Useful Tables --has tables of information that you may find useful for quick reference. Finally, Further Reading lists works that may be interesting for further reading on complete details, object orientation, programming with threads, software design, and other topics. Examples and Documentation All the code examples in the text have been compiled and run on the latest version of the language available at the time the book was written, which was the JDK 1.5.0_02 product version. Only supported features are covered--deprecated types, methods, and fields are ignored except when unavoidable or when knowledge of the past is necessary to understand the present. We have also covered issues beyond writing programs that simply compile. Part of learning a language is to learn to use it well. For this reason, we have tried to show principles of good programming style and design. In a few places we refer to online documentation. Development environments provide a way to automatically generate documentation (usually HTML documents) for a compiled class from its documentation comments. This documentation is normally viewed with a Web browser. Results! Why, man, I have gotten a lot of results. I know several thousand things that won't work. --Thomas Edison Excerpted from The Java Programming Language by James Gosling, David Holmes, Ken Arnold All rights reserved by the original copyright owners. Excerpts are provided for display purposes only and may not be reproduced, reprinted or distributed without the written permission of the publisher.

Author notes provided by Syndetics

Ken Arnold , formerly senior engineer at Sun Microsystems Laboratories, is a leading expert in object-oriented design and implementation. He was one of the original architects of the Jini(tm) technology, and the lead engineer of Sun's JavaSpaces(tm) technology.

James Gosling is a Fellow and Chief Technology Officer of Sun's Developer Products group, the creator of the Java programming language, and one of the computer industry's most noted programmers. He is the 1996 recipient of Software Development's "Programming Excellence Award." He previously developed NeWS, Sun's network-extensible window system, and was a principal in the Andrew project at Carnegie Mellon University, where he earned a Ph.D. in computer science.

David Holmes is director of DLTeCH Pty Ltd, located in Brisbane, Australia. He specializes in synchronization and concurrency and was a member of the JSR-166 expert group that developed the new concurrency utilities. He is also a contributor to the update of the Real-Time Specification for Java, and has spent the past few years working on an implementation of that specification.



Powered by Koha