Java' Programming Language / Edition 4

Java' Programming Language / Edition 4

by Ken Arnold
ISBN-10:
0321349806
ISBN-13:
2900321349803
Pub. Date:
08/17/2005
Publisher:
Pearson Education
Java' Programming Language / Edition 4

Java' Programming Language / Edition 4

by Ken Arnold
$42.33
Current price is , Original price is $69.99. You
$69.99 
  • SHIP THIS ITEM
    This Item is Not Available
  • PICK UP IN STORE

    Your local store may have stock of this item.

  • SHIP THIS ITEM

    Temporarily Out of Stock Online

    Please check back later for updated availability.


Overview

Direct from the creators of the Java(tm) programming language, the completely revised fourth edition of The Java(tm) Programming Language is an indispensable resource for novice and advanced programmers alike.

Developers around the world have used previous editions to quickly gain a deep understanding of the Java programming language, its design goals, and how to use it most effectively in real-world development. Now, Ken Arnold, James Gosling, and David Holmes have updated this classic to reflect the major enhancements in Java(tm) 2 Standard Edition 5.0 (J2SE(tm) 5.0).

The authors systematically cover most classes in Java's main packages, java.lang.*, java.util, and java.io, presenting in-depth explanations of why these classes work as they do, with informative examples. Several new chapters and major sections have been added, and every chapter has been updated to reflect today's best practices for building robust, efficient, and maintainable Java software.

Key changes in this edition include

*New chapters on generics, enums, and annotations, the most powerful new language features introduced in J2SE 5.0
*Changes to classes and methods throughout to reflect the addition of generics
*Major new sections on assertions and regular expressions
*Coverage of all the new language features, from autoboxing and variable argument methods to the enhanced for-loop and covariant return types
*Coverage of key new classes, such as Formatter and Scanner

The Java(tm) Programming Language, Fourth Edition, is the definitive tutorial introduction to the Java language and essential libraries and an indispensable reference for all programmers, including those with extensive experience. It brings together insights you can only get from the creators of Java: insights that will help you write software of exceptional quality.

Product Details

ISBN-13: 2900321349803
Publisher: Pearson Education
Publication date: 08/17/2005
Series: Java Series
Edition description: REV
Pages: 928
Product dimensions: 6.00(w) x 1.25(h) x 9.00(d)

About the Author


Ken Arnold, a Staff Engineer at Sun Microsystems Laboratories, is a leading expert in object-oriented design and implementation, one of the original architects of the Jini technology, and the lead engineer of Sun's JavaSpaces technology. He has written extensively on C and C++ topics for UNIX Review, and is a leading expert in object-oriented design, C, and C++.

James Gosling is a Fellow and Vice President at Sun Microsystems, 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, from which he holds a PhD in Computer Science.

David Holmes is a Senior Research Scientist at the Cooperative Research Centre for Enterprise Distributed Systems Technology (DSTC Pty Ltd), located in Brisbane, Australia. His work with Java technology has focused on concurrency and synchronization support in the language and virtual machine. He has presented tutorials on concurrency and design at numerous international object-oriented programming conferences. He completed his PhD at Macquarie University, Sydney, in 1999.

Read an Excerpt

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 programminglanguage 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

Table of Contents

1. A Quick Tour.
Getting Started.
Variables.
Comments in Code.
Named Constants.
Unicode Characters.
Flow of Control.
Classes and Objects.
Creating Objects.
Static or Class Fields.
The Garbage Collector.

Methods and Parameters.
Invoking a Method.
The this Reference.
Static or Class Methods.

Arrays.
String Objects.
Extending a Class.
Invoking Methods from the Superclass.
The Object Class.
Type Casting.

Interfaces.
Exceptions.
Packages.
The Java Platform.
Other Topics Briefly Noted.

2. Classes and Objects.
A Simple Class.
Class Members.
Class Modifiers.

Fields.
Field Initialization.
Static Fields.
final Fields.

Access Control.
Creating Objects.
Construction and Initialization.
Constructors.
Initialization Blocks.
Static Initialization.

Methods.
Static Methods.
Method Invocations.
Method Execution and Return.
Parameter Values.
Using Methods to Control Access.

This.
Overloading Methods.
The main Method.
Native Methods.

3. Extending Classes.
An Extended Class.
Constructors in Extended Classes.
Constructor Order Dependencies.

Inheriting and Redefining Members.
Overriding.
Hiding Fields.
Accessing Inherited Members.
Accessibility and Overriding.
Hiding Static Members.
The super Keyword.

Type Compatibility and Conversion.
Compatibility.
Explicit Type Casting.
Testing for Type.

What protected Really Means.
Marking Methods and Classes final.
Abstract Classes and Methods.
The Object Class.
Cloning Objects.
Strategies for Cloning.
Correct Cloning.
Shallow versus Deep Cloning.

Extending Classes: How and When.
Designing a Class to Be Extended.
Designing an Extensible Framework.

Single Inheritance versus Multiple Inheritance.

4. Interfaces.
A Simple Interface Example.
Interface Declarations.
Interface Constants.
Interface Methods.
Interface Modifiers.

Extending Interfaces.
Inheriting and Hiding Constants.
Inheriting, Overriding, and Overloading Methods.

Working with Interfaces.
Implementing Interfaces.
Using an Implementation.

Marker Interfaces.
When to Use Interfaces.

5. Nested Classes and Interfaces.
Static Nested Types.
Static Nested Classes.
Nested Interfaces.

Inner Classes.
Accessing Enclosing Objects.
Extending Inner Classes.
Inheritance, Scoping, and Hiding.

Local Inner Classes.
Anonymous Inner Classes.
Inheriting Nested Types.
Nesting in Interfaces.
Modifiable Variables in Interfaces.

Implementation of Nested Types.

6. Tokens, Operators, and Expressions.
Lexical Elements.
Character Set.
Comments.
Tokens.
Identifiers.
Keywords.

Types and Literals.
Reference Literals.
Boolean Literals.
Character Literals.
Integer Literals.
Floating*Point Literals.
String Literals.
Class Literals.

Variables.
Field and Local Variable Declarations.
Parameter Variables.
final Variables.

Array Variables.
Array Modifiers.
Arrays of Arrays.
Array Initialization.
Arrays and Types.

The Meanings of Names.
Arithmetic Operations.
Integer Arithmetic.
Floating*Point Arithmetic.
Strict and non*Strict Floating*Point Arithmetic.

General Operators.
Increment and Decrement Operators.
Relational and Equality Operators.
Logical Operators.
instanceof.
Bit Manipulation Operators.
The Conditional Operator ?:.
Assignment Operators.
String Concatenation Operator.
new.

Expressions.
Order of Evaluation.
Expression Type.
Implicit Type Conversions.
Explicit Type Casts.
String Conversions.

Member Access.
Finding the Right Method.

Operator Precedence and Associativity.

7. Control Flow.
Statements and Blocks.
if-else.
switch.
while and do-while.
for.
Labels.
break.
continue.
return.
What, No goto?

8. Exceptions.
Creating Exception Types.
throw.
Transfer of Control.
Asynchronous Exceptions.

The throws Clause.
throws Clauses and Method Overriding.
throws Clauses and Native Methods.

try, catch, and finally.
finally.

When to Use Exceptions.

9. Strings.
Basic String Operations.
String Comparisons.
String Literal Equivalence.

Utility Methods.
Making Related Strings.
String Conversions.
Strings and char Arrays.
Strings and byte Arrays.
Character Encodings.

The StringBuffer Class.
Modifying the Buffer.
Getting Data Out.
Capacity Management.


10. Threads.
Creating Threads.
Using Runnable.
Synchronization.
synchronized Methods.
Static Synchronized Methods.
synchronized Statements.
Synchronization Designs.

wait, notifyAll, and notify.
Details of Waiting and Notification.
Thread Scheduling.
Voluntary Rescheduling.

Deadlocks.
Ending Thread Execution.
Cancelling a Thread.
Waiting for a Thread to Complete.

Ending Application Execution.
volatile.
Thread Management, Security and ThreadGroup.
Threads and Exceptions.
Don't stop.

ThreadLocal Variables.
Debugging Threads.

11. Programming with Types.
Wrapper Classes.
Void.
Boolean.
Character.
Number.
The Integer Wrappers.
The Floating*Point Wrapper Classes.

Reflection.
The Class class.
Naming Classes.
Examining Class Members.
The Modifier Class.
The Field Class.
The Method Class.
Creating New Objects and the Constructor Class.
Access Checking and AccessibleObject.
Arrays.
Packages.
The Proxy Class.

Loading Classes.
The ClassLoader Class.
Preparing a Class for use.
Loading Related Resources.


12. Garbage Collection and Memory.
Garbage Collection.
A Simple Model.
Finalization.
Resurrecting Objects during finalize.

Interacting with the Garbage Collector.
Reachability States and Reference Objects.
The Reference Class.
Strengths of Reference and Reachability.
Reference Queues.


13. Packages.
Package Naming.
Type Imports.
Package Access.
Accessibility and Overriding Methods.

Package Contents.
Package Objects and Specifications.

14. Documentation Comments.
The Anatomy of a Doc Comment.
Tags.
@see.
{@link}.
@param.
@return.
@throws and @exception.
@deprecated.
@author.
@version.
@since.
{@docRoot}.

An Example.
External Conventions.
Overview and Package Documentation.
The doc*files Directory.

Notes on Usage.

15. The I/O Package.
Byte Streams.
InputStream.
OutputStream.

Character Streams.
Reader.
Writer.
Character Streams and the Standard Streams.

InputStreamReader and OutputStreamWriter.
A Quick Tour of The Stream Classes.
Synchronization and Concurrency.
Filter Streams.
Buffered Streams.
Piped Streams.
ByteArray Byte Streams.
CharArray Character Streams.
String Character Streams.
Print Streams.
LineNumberReader.
SequenceInputStream.
Pushback Streams.
StreamTokenizer.

The Data Byte Streams.
DataInput and DataOutput.
The Data Stream Classes.

Working with Files.
File Streams and FileDescriptor.
RandomAccessFile.
The File Class.
FilenameFilter and FileFilter.

Object Serialization.
The Object Byte Streams.
Making Your Classes Serializable.
Serialization and Deserialization Order.
Customized Serialization.
Object Versioning.
Serialized Fields.
The Externalizable Interface.
Documentation Comment Tags.

The IOException Classes.

16. Collections.
Collections.
Exception Conventions.

Iteration.
Ordering using Comparable and Comparator.
The Collection Interface.
Set and SortedSet.
HashSet.
TreeSet.

List.
ArrayList.
LinkedList.

Map and SortedMap.
HashMap.
TreeMap.
WeakHashMap.

Wrapped Collections and the Collections Class.
The Synchronization Wrappers.
The Unmodifiable Wrappers.
The Collections Utilities.

The Arrays Utility Class.
Writing Iterator Implementations.
Writing Collection Implementations.
The Legacy Collection Types.
Enumeration.
Vector.
Stack.
Dictionary.
Hashtable.

Properties.

17. Miscellaneous Utilities.
BitSet.
Observer/Observable.
Random.
StringTokenizer.
Timer and TimerTask.
Math and StrictMath.

18. System Programming.
The System Class.
Standard I/O Streams.
System Properties.
Utility Methods.

Creating Processes.
The Process Class.
Process Environments.
Portability.

Shutdown.
Shutdown Hooks.
The Shutdown Sequence.
Shutdown Strategies.

The Rest of the Runtime.
Loading Native Code.
Debugging.

Security.
The SecurityManager Class.
Permissions.
Security Policies.
Access Controllers and Privileged Execution.


19. Internationalization and Localization.
Locale.
Resource Bundles.
ListResourceBundle.
PropertyResourceBundle.
Subclassing ResourceBundle.

Time, Dates, and Calendars.
Calendars.
Time Zones.
GregorianCalendar and SimpleTimeZone.

Formatting and Parsing Dates and Times.
Internationalization and Localization for Text.
Collation.
Formatting and Parsing.
Text Boundaries.


20. Standard Packages.
java.awt—-The Abstract Window Toolkit.
java.applet—-Applets.
java.beans—-Components.
java.math—-Mathematics.
java.net—-The Network.
java.rmi—-Remote Method Invocation.
java.security —- Security Tools.
java.sql —- Relational Database Access.
Utility Subpackages.
Archive Files—-java.util.jar.
ZIP Files—-java.util.zip.

javax.*—-Standard Extensions.
javax.accessibility —- Accessibility for GUIs.
javax.naming—-Directory and Naming Services.
javax.sound—-Sound Manipulation.
javax.swing —- Swing GUI Components.
org.omg.CORBA —- CORBA APIs.

Appendix A. Runtime Exceptions.
RuntimeException Classes.
Error Classes.

Appendix B Useful Tables.
Table 1: Keywords.
Table 2: Operator Precedence.
Table 3: Unicode Digits.
Table 4: Unicode Letters and Digits.
Table 5: Special Characters Using \.
Table 6: Documentation Comment Tags.
Table 7: Unicode Character Blocks.

Further Reading.
Index.

Preface

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 com munity of software developers and Internet content providers. Users of the Inter net 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 dif ferent 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 program ming errors never occur because of features like garbage collection and type-safe references. Support for multithreading caters to modern network-based and graph ical user interface—based applications that must attend to multiple tasks simulta neously, 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 any where 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 ardu ously formal or complete. This book is not an introduction to object-oriented pro gramming, although some issues are covered to establish a common terminology. Other books in this series, and much online documentation, focus on applets, graphical interfaces, databases, components, and other specific kinds of program ming tasks. For other references, see "Further Reading" on page 563.

This third edition includes the changes introduced in the Java 2 Platform, such as the new strictfp keyword, collection classes, and reference objects, as imple mented in the Java 2 SDK, Standard Edition Version 1.3 (sometimes colloquially referred to as JDK 1.3 or simply 1.3). You will also find brief coverage of the other main packages. If you have already read the second edition, you will find that much of the information in this edition has been restructured to improve the presentation of language features—-such as nested classes and interfaces—-and class API's. This edition will give you a lot of new information, but since most of the language is unchanged, and almost all main package types are still usable, you will want to pay most attention to the newer areas.

The Java programming language shares many features common to most pro gramming 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. Program mers 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.

Chapters 2, 3, 4, and 5 cover the object-oriented core features of the language, namely, class declarations that define components of a program, and objects man ufactured 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,orsubclassed, to create a new class with additional data and behavior. Chapter 4—-Interfaces—-describes how to declare interface types which 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.

Chapters 6 and 7 cover standard constructs common to most languages. Chap ter 6—-Tokens, Operators, and Expressions—-describes the tokens of the language from which statements are constructed, how the tokens and operators are used to build expressions, and how expressions are evaluated. Chapter 7—-Control Flow—-describes how control statements direct the order of statement execution. Chapter 8—-Exceptions—-describes the language's powerful error-handling capabilities. Chapter 9—-Strings—-describes the built-in language and runtime support for String objects.

Chapter 10—-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 11—-Programming with Types—-describes the type-related classes: individual objects that describe each class and interface, and classes that wrap primitive data types such as integers and floating-point values into their own object types.

Chapter 12—-Garbage Collection and Memory—-talks about garbage collec tion, finalization, and lower-strength reference objects.

Chapter 13—-Packages—-describes how you can group collections of classes and interfaces into separate packages.

Chapter 14—-Documentation Comments—-shows how to write reference doc umentation in comments.

Chapters 15 through 19 cover the main packages. Chapter 15—-The I/O Pack age—-describes the input/output system, which is based on streams. Chapter 16— Collections—-covers the collection or container classes such as sets and lists.

Chapter 17—-Miscellaneous Utilities—-covers the rest of the utility classes such as bit sets and random number generation. Chapter 18—-System Programming— leads you through the system classes that provide access to features of the under lying platform. Chapter 19—-Internationalization and Localization—-covers some of the tools used to create programs that can run in many linguistic and cultural environments.

Chapter 20—-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—-Runtime Exceptions—-lists all the runtime exceptions and errors that the runtime system itself can throw.

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 read ing 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 Java 2 SDK, Standard Edition, Version 1.3. Only supported features are covered—-depre cated types, methods, and fields are ignored except where unavoidable. 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 princi ples 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 docu ments) from a compiled class using the documentation comments. This documen tation is normally viewed using a Web browser.

ACKNOWLEDGMENTS (FIRST EDITION)

No technical book-writing endeavor is an island unto itself, and ours was more like a continent. Many people contributed technical help, excellent reviews, useful information, and book-writing advice.

Contributing editor Henry McGilton of Trilithon Software played the role of "chief editorial firefighter" to help make this book possible. Series editor Lisa Friendly contributed dogged perseverance and support.

A veritable multitude of reviewers took time out of their otherwise busy lives to read, edit, advise, revise, and delete material, all in the name of making this a better book. Kevin Coyle performed one of the most detailed editorial reviews at all levels. Karen Bennet, Mike Burati, Patricia Giencke, Steve Gilliard, Bill Joy, Rosanna Lee, Jon Madison, Brian O'Neill, Sue Palmer, Stephen Perelgut, R. Anders Schneiderman, Susan Sim, Bob Sproull, Guy Steele, Arthur van Hoff, Jim Waldo, Greg Wilson, and Ann Wollrath provided in-depth review. Geoff Arnold, Tom Cargill, Chris Darke, Pat Finnegan, Mick Jordan, Doug Lea, Randall Murray, Roger Riggs, Jimmy Torres, Arthur van Hoff, and Frank Yellin contributed useful comments and technical information at critical junctures.

Alka Deshpande, Sharon Flank, Nassim Fotouhi, Betsy Halstead, Kee Hinck ley, Dr. K. Kalyanasundaram, Patrick Martin, Paul Romagna, Susan Snyder, and Nicole Yankelovich collaborated to make possible the five words of non-ISO Latin-1 text on pages 140 and 406. Jim Arnold provided research help on the proper spelling, usage, and etymology of "smoog" and "moorge." Ed Mooney helped with the document preparation. Herb and Joy Kaiser were our Croatian language consultants. Cookie Callahan, Robert E. Pierce, and Rita Tavilla pro vided the support necessary to keep this project going at many moments when it would otherwise have stalled with a sputtering whimper.

Thanks to Kim Polese for supplying us the capsule summary of why the Java programming language is important to computer users as well as programmers. Support and advice were provided at critical moments by Susan Jones, Bob Sproull, Jim Waldo, and Ann Wollrath. And we thank our families, who, besides their loving support, would at times drag us out to play when we should have been working, for which we are deeply grateful.

And thanks to the folks at Peet's Coffee and Tea, who kept us buzzed on the best Java on the planet.

ACKNOWLEDGMENTS (SECOND EDITION)

The cast of characters for this second edition is much like the first. Series Editor Lisa Friendly continued to be doggedly supportive and attentive. The set of reviewers was smaller, overlapping, and certainly as helpful and thor ough. Overall reviews by Steve Byrne, Tom Cargill, Mary Dageforde, Tim Lind holm, and Rob Murray were critical to clarity. Brian Beck, Peter Jones, Doug Lea, Bryan O'Sullivan, Sue Palmer, Rosanna Lee, Lori Park, Mark Reinhold, Roger Riggs, Ann Wollrath, and Ken Zadek contributed focused reviews of important parts. Guy Steele's support was ongoing and warm. Rosemary Simpson's exten sive and intensive efforts to make a useful index are deeply appreciated. Carla Carlson and Helen Leary gave logistic support that kept all the wheels on the tracks instead of in the ditch. Gerry Wiener provided the Tibetan word on page 406, and we also had help on this from Craig Preston and Takao Miyatani. All who submitted errata and suggestions from the first edition were helpful.

For some inexplicable reason we left the friendly folks of Addison-Wesley off the original acknowledgments—-luckily, most of them were present again for this edition. A merged list for both editions includes Kate Duffy, Rosa Gonzales, Mike Hendrickson, Marina Lang, Shannon Patti, Marty Rabinowitz, Sarah Weaver, and Pamela Yee. Others did much that we are blissfully unaware of, but for which we are nonetheless abidingly grateful.

The revision was additionally aided by Josh Bloch, Joe Fialli, Jimmy Torres, Benjamin Renaud, Mark Reinhold, Jen Volpe, and Ann Wollrath. And Peet's Coffee and Tea continued its supporting role as purveyor to the caffeine-consuming connoisseur.

ACKNOWLEDGMENTS (THIRD EDITION)

The third edition required yet more reviews and work, and the helper list is equally critical. Lisa Friendly continued her attempts to keep the project in line; someday we will cooperate better. The set of reviewers included new faces and old friends, all helpful: Joshua Bloch, Joseph Bowbeer, Gilad Bracha, Keith Edwards, Joshua Engel, Rich Gillam, Peter Haggar, Cay Horstmann, Alexander Kuzmin, Doug Lea, Keith Lea, Tim Lindholm, David Mendenhall, Andrew M. Morgan, Ray Ortigas, Brian Preston, Mark Schuldenfrei, Peter Sparago, Guy Steele, Antoine Trux, and our Russian compatriots Leonid Arbouzov, Valery Shakurov, Viatcheslav Rybalov, Eugene Latkin, Dmitri Khukhro, Konstantin Anisimov, Alexei Kaigorodov, Oleg Oleinik, and Maxim Sokolnikov. Several people let us bend their ears to figure out how to approach things better: Peter Jones, Robert W. Scheifler, Susan Snyder, Guy Steele, Jimmy Torres, and Ann Wollrath. Helen Leary made the logistics work smoothly, as always. Material support is always provided by the Addison-Wesley team: Julie DiNi cola, Mike Hendrickson, and Tracy Russ.

And since the last edition, Peet's Coffee and Tea has opened up on the East Coast, so the eastern part of this writing team can enjoy it regularly. The world continues to improve apace.

Any errors or shortcomings that remain in this book—-despite the combined efforts of these myriads—-are completely the responsibility of the authors.

Results! Why, man, I have gotten a lot of results.
I know several thousand things that won't work.
Thomas Edison


From the B&N Reads Blog

Customer Reviews