Errata for
The Java Programming Language
Fourth Edition
by
Ken Arnold, James Gosling and David Holmes
Third Printing
Get your facts first, then you can distort them as you
please.
-- Mark Twain
This page contains the technical errata -- those things that are wrong or
lead you astray -- in the Third Printing of the book. You may also want to view the minor
errata list, especially before you email us about an error.
You can tell which printing you have by looking at the bottom of the
copyright page (the page that faces the dedication page, and starts with
"Copyright © 2006 by Sun Microsystems, Inc."). The last line on this
page gives the printing number and date.
If you find an error in the book, please check to see if it is already known
before reporting it. If you do not find it in the list, please mail
us the relevant information, including page numbers. All errata will be
fixed in the next possible printing. We are thankful to all
those who have reported errata.
Errata for all printings:
CHAPTER 1: A Quick Tour
CHAPTER 2: Classes and Objects
- Clarification: On page 46 when discussing constant variables there
is one corner case that is not discussed. For the case of a final String
variable, an initialization expression that evaluates to null is
not a constant expression and any such initialized variable is not a
constant variable and its value is not used by the compiler to replace a
reference to the variable. Of course, initializing a final String
variable with the value null is a rather pointless thing to do, so
this case has no practical significance and wasn't considered worth
mentioning.
CHAPTER 3: Extending Classes
CHAPTER 4: Interfaces
CHAPTER 5: Nested Classes and Interfaces
CHAPTER 6: Enumeration Types
CHAPTER 7: Tokens, Values and Variables
CHAPTER 8: Primitives as Types
CHAPTER 9: Operators and Expressions
CHAPTER 10: Control Flow
- On page 232 we discuss the switch statement and how an enum type
can be used as the switch expression, with enum constants as the case
labels. There is an omission in this description due to a late change in the
Java Language Specification, third edition. When the switch expression is of
an enum type, the case labels must be unqualified enum constants of that
type. Allowing the omission of the qualifier on the constant is a nice
convenience, but requiring that it be omitted leads to a strange
inconsistency: the enum contant in the label must be unqualified yet any use
of that same enum constant within the statements for that case must be
qualified (unless the enum constants have been imported through a static
import).
CHAPTER 11: Generic Types
CHAPTER 12: Exceptions and Assertions
CHAPTER 13: Strings and Regular Expressions
CHAPTER 14: Threads
CHAPTER 15: Annotations
CHAPTER 16: Reflection
CHAPTER 17: Garbage Collection and Memory
CHAPTER 18: Packages
CHAPTER 19: Documentation Comments
CHAPTER 20: The I/O Package
CHAPTER 21: Collections
CHAPTER 22: Miscellaneous Utilities
CHAPTER 23: System Programming
CHAPTER 24: Internationalization and
Localization
CHAPTER 25: Standard Packages
APPENDIX A: Application Evolution
APPENDIX B: Useful Tables
Further Reading
Index