Errata

Java in a Nutshell

Errata for Java in a Nutshell

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
Printed
Page 4
after "Inter[reted", line 1: deleted the extra "an"

and line -4: deleted the extra "a"

Anonymous    Jul 01, 1997
Printed
Page 6

next-to-last para., last sentence now reads:

Finally, and very importantly, Java's automatic garbage collection
relieves the developer of many of the mundane housecleaning tasks
normally associated with memory management, which helps avoid
pernicious bugs related to memory allocation and deallocation.

Anonymous    Oct 01, 1997
Printed
Page 6

next-to-last para., last sentence now reads:

Finally, and very importantly, Java's automatic garbage collection
relieves the developer of many of the mundane housecleaning tasks
normally associated with memory management, which helps avoid
pernicious bugs related to memory allocation and deallocation.

Anonymous    Sep 01, 1997
Printed
Page 7
next-to-last line: changed "seems to reasonable" to "seems

reasonable"

Anonymous    Jan 01, 1998
Printed
Page 8
1st sentence of last para: changed "use commonplace" to "use is

commonplace"

Anonymous    Jan 01, 1998
Printed
Page 12
last para., next-to-last line: changed "that this these" to

"that these"

Anonymous    Jan 01, 1998
Printed
Page 17
the line "set CLASSPATH .;C:...." now has an equals sign, like this

"set CLASSPATH=.;C:...." (Note that this is for the second CLASSPATH line
only; do not change the first one.)

Anonymous    Dec 01, 1998
Printed
Page 17
last code sample: "setenv" changed to "set"

Anonymous    Aug 01, 1997
Printed
Page 18
line 2: "overides" was changed to "overrides"

Anonymous    May 01, 1998
Printed
Page 20
bullet item 3: changed "in different" to "in a different"

Anonymous    Jan 01, 1998
Printed
Page 20
bullet 3: "are accessible" changed to "is accessible"

Anonymous    Aug 01, 1997
Printed
Page 23
Under Primitive Data Types section, line 5:

Changed the following sentence:

In Java, all variables have guaranteed default values, though the
compiler may warn you in places where you rely, accidentally, or not,
on these default values.

to

The same is true in Java; the Java compiler does not let you write code
that uses uninitialized local variables. Note, however,that the fields
of Java objects do not have garbage values; they are automatically
initialized to standard default values.

Anonymous    Dec 01, 1998
Printed
Page 24
TAble 2-2, float and double entires: swapped maximum values

Anonymous    Aug 01, 1997
Printed
Page 29
second para. under "Garbage Collection": changed the last

sentence to read:

This means that in our programs, we spend less time worrying about
freeing memory and destroying objects--the garbage collector takes
care of that.

Anonymous    Oct 01, 1997
Printed
Page 29
second para. under "Garbage Collection": changed the last

sentence to read:

This means that in our programs, we spend less time worrying about
freeing memory and destroying objects--the garbage collector takes
care of that.

Anonymous    Sep 01, 1997
Printed
Page 30
paragraph 5, line 2: "initialzier" was changed to "initializer"

Anonymous    May 01, 1998
Printed
Page 30
line -3: "256 byte" changed to "16 byte"

Anonymous    Aug 01, 1997
Printed
Page 31
6 line code roughly in the middle of the page. The second last line of

code:

triangle[i][j] = (short) i+j;

now reads

triangle[i][j] = (short) (i+j);

Anonymous    Dec 01, 1998
Printed
Page 31
end of the last paragraph, added this sentence

"As in C, Java arrays are zero-based (the first element is element 0,
not 1)."

Anonymous    Dec 01, 1998
Printed
Page 33
paragraph 5, line 1: "NUL" was changed to "NULL"

Anonymous    May 01, 1998
Printed
Page 36
Under "The switch statement", 3rd sent.: removed "long" from the

italicized list

Anonymous    Dec 01, 1998
Printed
Page 36
The switch Statement: The sentence

"The switch statement is the same in Java as it is in C."

was changed to

"The switch statement is the much the same in Java as it is in C. The
values in case statements must be constants or variables that are
declared final."

Anonymous    May 01, 1998
Printed
Page 37
line 13: "variable" changed to "variables"

Anonymous    Aug 01, 1997
Printed
Page 40
The following footnote was added near the bottom of the page

Unless the program itself exits with f(CWSystem.exit()fR.

Put this footnote at the end of the following sentence:

The statements of a finally block are guaranteed to be executed,
regardless of how the code in the try block exits.

Anonymous    Mar 01, 1999
Printed
Page 42
para. -2, line -2: "a class the" changed to "a class that"

Anonymous    Aug 01, 1997
Printed
Page 43
paragraph 4,line 5: changed "Java API" to "the Java API"

Anonymous    May 01, 1998
Printed
Page 47
Changed the following


"Before running a synchronized instance method, Java obtains a lock on
the instance that invoked the method, ..."

to

"Before running a synchronized instance method, Java obtains a lock on
the object, ..."

Anonymous    Dec 01, 1998
Printed
Page 61
code 1, line -4: changed "Peturn" to "Return"

Anonymous    Jul 01, 1997
Printed
Page 66
deleted comma in the last line

Anonymous    Aug 01, 1997
Printed
Page 69
final methods, line -2: changed "methods cannot" to "method cannot"

and line -2: deleted "the" before "when the"

Anonymous    Jul 01, 1997
Printed
Page 70
line -5 of para. 2: changed "instance of the class or a

subclass of it, then" to "instance of the class, then"

Anonymous    Oct 01, 1997
Printed
Page 70
line 5: the statement, "static methods cannot be overridden"

is not true; they can be overridden.

>From the author: The statement is correct; however, it could be
clarified as follows:

replace the current text: "static methods cannot be overridden,
so..." with:

f(CWstaticfP methods, by their very nature, are not
inherited,
and thus cannot be overridden. Thus...

Anonymous    Mar 01, 1999
Printed
Page 70
para. 2, line -5: delted the extra "a"

Anonymous    Jul 01, 1997
Printed
Page 70
line -5 of para. 2: changed "instance of the class or a

subclass of it, then" to "instance of the class, then"

Anonymous    Sep 01, 1997
Printed
Page 73
Remove the fourth paragraph (the one that starts "There is an

important point..." and replace it with:

There is an important point to make about subclass access to
f(CWprotectedfR members. A subclass inherits the
f(CWprotectedfR members of its superclass, but it can only
use those members through instances of itself, not directly in
instances of the superclass. Suppose, for example, that
f(CWAfR is a f(CWpublicfR class that defines a
f(CWprotectedfR field f(CWffR and a
f(CWprotectedfR method f(CWm()fR. Now,
suppose that f(CWBfR is a subclass of f(CWAfR
defined in a different package. f(CWBfR inherits the field
f(CWffR and the method f(CWm()fR from
f(CWAfR, and the methods of f(CWBfR can refer
to the inherited field and method with expressions like
f(CWffR, f(CWm()fR, f(CWthis.ffR,
and f(CWthis.m()fR. However, if a method in
f(CWBfR creates an instance f(CWafR of class
f(CWAfR, it fIcannotfR use the field
f(CWffR and the method f(CWm()fR of that
object. That is, the class f(CWBfR cannot use expressions
like f(CWa.ffR and f(CWa.m()fR.

("f(CW" and "fR" indicate that the intervening text should appear in
constant width font.)

Anonymous    Mar 01, 1999
Printed
Page 73
para. 4, sentence 2 now reads "it can access" (deleted "use")

Anonymous    Aug 01, 1997
Printed
Page 74
Example 3-14, changed the following line

"private boolean check_radius(double r) { return (r <= MAXR); }"

to

"private static boolean check_radius(double r) { return (r <= MAXR); }"

Anonymous    Dec 01, 1998
Printed
Page 77
in the paragraph immediately after Example 3-16, added the following

sentence:

"Interface methods are also all implicitly public."

(Note "public" is in constant width.)

Anonymous    Dec 01, 1998
Printed
Page 82
bullet item 6: changed "explictly" to "explicitly"

Anonymous    Jan 01, 1998
Printed
Page 91
para. 5, line -1: "printer use" now reads "printer to use"

Anonymous    Dec 01, 1998
Printed
Page 96
line 1: "compliment" changed to "complement"

Anonymous    Aug 01, 1997
Printed
Page 97
line 3 of para. 2 under "Object Serialization": changed "that

subclass the Serializable" to "that implement the Serializable"

Anonymous    Oct 01, 1997
Printed
Page 97
line 3 of para. 2 under "Object Serialization": changed "that

subclass the Serializable" to "that implement the Serializable"

Anonymous    Sep 01, 1997
Printed
Page 99
under "Enterprise APIs...": changed "and Security packages will

be documented, along with other, forthcoming APIs, in a separate
volume, Java Enterprise in a Nutshell." to "and Security packages may
be documented, along with other, forthcoming APIs, in a separate
volume."

Anonymous    Oct 01, 1997
Printed
Page 99
under "Enterprise APIs...": changed "and Security packages will

be documented, along with other, forthcoming APIs, in a separate
volume, Java Enterprise in a Nutshell." to "and Security packages may
be documented, along with other, forthcoming APIs, in a separate
volume."

Anonymous    Sep 01, 1997
Printed
Page 103

Changed the footnote to read:

Unfortunately, in Java 1.1 there are compiler bugs that prevent
access to the f(CWprivatefR fields and methods of enclosing
classes from working correctly. This bug has been fixed in
Java 1.2.

("f(CW" and "fR" indicate that the intervening text is in constant width
font.)

Anonymous    Dec 01, 1998
Printed
Page 104
Changed the following line in Example 5-1

"public interface Linkable {"

to

"public static interface Linkable {"

Anonymous    Dec 01, 1998
Printed
Page 105
Remove the first paragraph of the "Nested Top-Level Classes

and .class Files" section and replace it with:

When you compile the fILinkedList.javafR file shown in
Example 5-1, you'll find that three class files are generated. The
first two are named fILinkedList.classfR and
fILinkableInteger.classfR, as expected. The third,
however, is named fILinkedList$Linkable.classfR. The
f(CW$fR in this name is automatically inserted by the Java
compiler.

("fI" and "fR" indicate that the intervening text appears in italic.)

Anonymous    Mar 01, 1999
Printed
Page 105
Example 5-1, line 2: changed "public remove(Linkable node)" to

"public void remove(Linkable node)"

Anonymous    May 01, 1998
Printed
Page 114
paragraph 4, line 3: changed "to do to" to "do to"

Anonymous    May 01, 1998
Printed
Page 117
Example 5-7, line 10: changed "this.new Local()" to "new Local()"

Anonymous    May 01, 1998
Printed
Page 127
last line: changed "applets security" to "applets"

Anonymous    Oct 01, 1997
Printed
Page 127
last line: changed "applets security" to "applets"

Anonymous    Sep 01, 1997
Printed
Page 133
next-to-last line before code example: put "appletviewer" in

italics instead of constant width

Anonymous    Oct 01, 1997
Printed
Page 133
next-to-last line before code example: put "appletviewer" in

italics instead of constant width

Anonymous    Sep 01, 1997
Printed
Page 135
next-to-last bullet: added "the" before "'XOR mode'"

Anonymous    Oct 01, 1997
Printed
Page 135
next-to-last bullet: added "the" before "'XOR mode'"

Anonymous    Sep 01, 1997
Printed
Page 139
dash 3: "existence" spelled correctly

Anonymous    Aug 01, 1997
Printed
Page 144
line -4: "method the" changed to "method of the"

Anonymous    Aug 01, 1997
Printed
Page 147
text para. 1, line 2: changed "which list the" to "which lists

the"

Anonymous    Oct 01, 1997
Printed
Page 147
text para. 1, line 2: changed "which list the" to "which lists

the"

Anonymous    Sep 01, 1997
Printed
Page 149
example 7-1: added a line after "g = this.getGraphics():"

this.requestFocus(); //Ask for keyboard focus so we get key events

Anonymous    Oct 01, 1997
Printed
Page 149
example 7-1: added a line after "g = this.getGraphics():"

this.requestFocus(); //Ask for keyboard focus so we get key events

Anonymous    Sep 01, 1997
Printed
Page 158
line 1: changed "addition the new" to "addition to the new"

also, line 2 of para. 3: changed "the the" to "than the"

Anonymous    Jan 01, 1998
Printed
Page 160
2nd code block: changed lines 2 and 3 from

if (e.isPopupTrigger()) // If popup trigger,
popup.show(this, e.getX(), e.getY()); // pop up the menu

to:

if (e.isPopupTrigger()) { // If popup trigger,
popup.show(this, e.getX(), e.getY()); e.consume(); } // pop up the menu

Anonymous    Oct 01, 1997
Printed
Page 160
2nd code block: changed lines 2 and 3 from

if (e.isPopupTrigger()) // If popup trigger,
popup.show(this, e.getX(), e.getY()); // pop up the menu

to:

if (e.isPopupTrigger()) { // If popup trigger,
popup.show(this, e.getX(), e.getY()); e.consume(); } // pop up the menu

Anonymous    Sep 01, 1997
Printed
Page 166
line 19: changed "specifies big" to "specifies how big"

Anonymous    Aug 01, 1997
Printed
Page 167
made the same change to line 4 and 5

Anonymous    Oct 01, 1997
Printed
Page 167
made the same change to line 4 and 5

Anonymous    Sep 01, 1997
Printed
Page 175
comment at top of page: changed "array or ints" to "array of

ints"

Anonymous    Jan 01, 1998
Printed
Page 176
para. 3 line 4: changed "proided" to "provided"

Anonymous    Jan 01, 1998
Printed
Page 180
line 1 of code: changed "oreilly.beans.yesno" to

"oreilly.beans"

Anonymous    Oct 01, 1997
Printed
Page 180
paragraph 3, line 2: changed "as a bean a" to "as a bean as"

Anonymous    May 01, 1998
Printed
Page 180
line 1 of code: changed "oreilly.beans.yesno" to

"oreilly.beans"

Anonymous    Sep 01, 1997
Printed
Page 183
text para 1, line 5: changed "with c option" to "with the c

option"

Anonymous    Jan 01, 1998
Printed
Page 183
code 3 and 4, line 1 of both changed to

"... oreilly/beans/yesno/MultiLineLabel.class"

Anonymous    Aug 01, 1997
Printed
Page 189
line 2 of text para. 1: changed "ActionListener" to

"AnswerListener"

Anonymous    Oct 01, 1997
Printed
Page 189
line 2 of text para. 1: changed "ActionListener" to

"AnswerListener"

Anonymous    Sep 01, 1997
Printed
Page 199
changed the "Boolean Properties" section. It looks like this

now:

Boolean Properties (property p of type Boolean)
getter: public boolean getP() or
public boolean isP()
setter: public void setP()

Anonymous    Oct 01, 1997
Printed
Page 199
changed the "Boolean Properties" section. It looks like this

now:

Boolean Properties (property p of type Boolean)
getter: public boolean getP() or
public boolean isP()
setter: public void setP()

Anonymous    Sep 01, 1997
Printed
Page 211
next-to-last line: changed "cast" to "casts"

Anonymous    Oct 01, 1997
Printed
Page 211
next-to-last line: changed "cast" to "casts"

Anonymous    Sep 01, 1997
Printed
Page 218
text para. between code examples, last line: changed

"messages the following" to "messages like the following"

Anonymous    Oct 01, 1997
Printed
Page 218
text para. between code examples, last line: changed

"messages the following" to "messages like the following"

Anonymous    Sep 01, 1997
Printed
Page 220
Example 12-1, line 7: after "print_class(c);" added a new line,

"System.exit(0);"

Anonymous    May 01, 1998
Printed
Page 232
changed "passed as an" to "passed an"

Anonymous    Apr 01, 1999
Printed
Page 233
para. -1, line 1: there should be only one "any"

Anonymous   
Printed
Page 247
first example

% jar cvf my.jar *.java images

now reads

% jar cvf my.jar *.class images

Anonymous    Dec 01, 1998
Printed
Page 249
changed "Where $JAVA is JDK" to "Where $JAVA is the JDK"

Anonymous    Apr 01, 1999
Printed
Page 254, 255
Options: changed "-author path" to "-author" and "-version

path" to "-version"

Anonymous    May 01, 1998
Printed
Page 283
java.awt.AWTEventMultiCaster, para. 2, line 4:

"...defines a quite a few methods"

should be

"...defines quite a few methods"

Anonymous   
Printed
Page 298
java.awt.Dialog, line 7: changed "hide()" to "setVisible(false)"

Anonymous    May 01, 1998
Printed
Page 305
java.awt.Frame, line 6: changed the sentence

"Call the show() method of Window to make a frame appear on the screen
or to bring it to the front of the window stack. Call hide() to
remove a frame from the screen."

to

"Call the show() method of a Window to make the window appear and be
brought to the top of the window stack. Call setVisible(false) to
make the window disappear."

Anonymous    May 01, 1998
Printed
Page 316
changed "loaded are are ready" to "loaded and are ready"

Anonymous    Apr 01, 1999
Printed
Page 331
java.awt.TextField, line 2: changed "setEchoCharacter()" to

"setEchoChar()"

Anonymous    May 01, 1998
Printed
Page 352

(352) line 9, fixed formatting

Anonymous    Jul 01, 1997
Printed
Page 358
last line of "WINDOW_CLOSING": changed "destroy()" to "dispose()"

Anonymous    Oct 01, 1997
Printed
Page 358
In the desription of java.awt.event.WindowEvent, under

"WINDOW_CLOSED", "destroy()" now reads "dispose()"

Anonymous    Dec 01, 1998
Printed
Page 358
last line of "WINDOW_CLOSING": changed "destroy()" to "dispose()"

Anonymous    Sep 01, 1997
Printed
Page 382
Figure 23-1 should say "java.util" instead of

"java.io" in the bottom-left dotted rectangle. Note that the rectangle
above that correctly says "java.io"

Anonymous    Mar 01, 1999
Printed
Page 418
text para. 2: changed "property" to "properly"

Anonymous    Aug 01, 1997
Printed
Page 467
para 1, line 2: changed "getInputStream" to "getErrorStream"

in line 4, changed "getErrorStream" to "getInputStream"

Anonymous    Jan 01, 1998
Printed
Page 481
last line: changed "getInteger()" to "getInt()"

Anonymous    Oct 01, 1997
Printed
Page 481
last line: changed "getInteger()" to "getInt()"

Anonymous    Sep 01, 1997
Printed
Page 602
Deleted "Object class" entry near the bottom of the page.

Anonymous    Apr 01, 1999
Printed
Page 603

Added page numbers to "Object class" entry so it now reads:

Object class, 64, 233, 441, 465

Anonymous    Apr 01, 1999
Printed
Page 604
changed entry for "print(), Applet class" to refer to p. 128

Anonymous    Jan 01, 1998
Printed
Page 611
next-to-last para.: made sentence in bold un-bold

Anonymous    Oct 01, 1997
Printed
Page 611
fixed the too-fat lines; also, changed the first para. of the

Colophon:

The animal featured on the cover of Java in a Nutshell is a Javan
tiger. It is the smallest of the eight subspecies of tiger, and has
the longest cheek whiskers, forming a short mane across the neck. The
encroachment of the growing human population, along with increases in
poaching, led to the near-extinction of the Javan tiger. The
Indonesian government has become involved in trying to preserve the
tiger. It is to be hoped that the remaining subspecies of tiger will
be helped by increasing awareness and stricter protections.

Anonymous    Jan 01, 1998
Printed
Page 611
next-to-last para.: made sentence in bold un-bold

Anonymous    Sep 01, 1997