Errata

Java: The Good Parts

Errata for Java: The Good Parts

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 57
example code

In text you explain that you don't have a readIn.close(); in the constructor but only in the finalize method. But in the example code you have a readIn.close(); right after the object has been read.

Note from the Author or Editor:
The line
readIn.close();
in the try block of the constructor should be removed.

Andor  Feb 14, 2011  Sep 09, 2011
Printed
Page 169
paragraph 1, line 5

"HashTable" should be "Hashtable".

Note from the Author or Editor:
This is correct; the word "HashTable" in the fifth line of the first paragraph should be "Hashtable"

Wang JiangPing  Jan 24, 2011  Sep 09, 2011
Printed
Page 149
paragraph 1, line 7

"... and the method finishes.", should it not be "the thread finishes"? Note that there is already a "Once the method is finished" in this sentence before.

Note from the Author or Editor:
There is an error here, but not the one indicated. However, the phrasing is confusing. So please change the seventh line in the first paragraph from

...the boolean isDone is set to true and the method finishes.

to

...the boolean done is set to true and the method (and the thread) finishes.

Note that "boolean done" should be in the code font.

Wang JiangPing  Jan 24, 2011  Sep 09, 2011
Printed
Page 123
paragraph 2, line 3

"(or a super-type ...", should it not be "sub-type"?

Note from the Author or Editor:
This is not an error; in fact a super-type will be fine here. However, to clarify, perhaps the line should be changed from
...(or a super-type of this exception)

to

...(or a super-type of this exception, such as java.io.IOException)

where "java.io.IOException" is in the code font.

Wang JiangPing  Jan 24, 2011  Sep 09, 2011
Printed
Page 113
paragraph 2, line 1

"We start by creating a TreeSort object ...", "TreeSort" should be "TreeSet".

Note from the Author or Editor:
This is correct, please change "TreeSort" to "TreeSet"

Wang JiangPing  Jan 24, 2011  Sep 09, 2011
Printed
Page 98
paragraph 2, line 4

"... returned from the hasNext() method ...", "hasNext()" should be "next()"

Note from the Author or Editor:
This is correct, please change the instance of
hasNext()
in line 4 of the paragraph to
next()

Wang JiangPing  Jan 24, 2011  Sep 09, 2011
Printed
Page 55
paragraph 1, line 5

"Chapter 7" should be "Chapter 8".

Note from the Author or Editor:
This is correct (although it occurs on page 58); please change the last number in the first paragraph from "7" to "8"

Wang JiangPing  Jan 24, 2011  Sep 09, 2011
Printed
Page 51
paragraph 3, line 6

"foo->bar" should be "fooptr->bar".

Note from the Author or Editor:
this is correct; please change the instance of foo->bar in the third paragraph to fooptr->bar (in the code font)

Wang JiangPing  Jan 24, 2011  Sep 09, 2011
Printed
Page 26
paragraph 6, line 4

"... the exception must deal with the exception", the first "exception" should be "method".

Note from the Author or Editor:
This is correct; please change the line

so the compiler can enforce the rule that any method calling the exception must deal with the exception.

to

so the compiler can enforce the rule that any method calling the method must deal with the exception.

Wang JiangPing  Jan 24, 2011  Sep 09, 2011
Printed
Page 26
paragraph 2, line 5

"... as part of the signature of that exception", "exception" should be "method".

Note from the Author or Editor:
this is correct; please change the line from
...to be declared as part of the signature of that exception.

to

...to be declared as part of the signature of that method.

Wang  Jan 24, 2011  Sep 09, 2011
Printed
Page 25
paragraph 1, line 3

because the basic class of Throwable extends ...
"extends" should be "implements".

Note from the Author or Editor:
This is correct; please change
...because the basic class of Throwable extends the Serializable interface...

to

...because the basic class of Throwable implements the Serializable interface...

Wang JiangPing  Jan 24, 2011  Sep 09, 2011
Printed, PDF
Page 155
1st paragrapfh

In line 2, reference of intanceof() is an error.
The correct is instanceof, cos is a word key and not a implemented method.

Note from the Author or Editor:
This is correct; please change
instanceof()

to

instanceof

Josivan Pereira de Souza  Dec 11, 2010  Sep 09, 2011
Printed, PDF
Page 110, 111
in a lot of paragraph

All occurrences of Comparitor, would be Comparator.

Note from the Author or Editor:
This is correct; please do a search for Comparitor and replace all instances with Comparator

Josivan de Souza  Nov 14, 2010  Sep 09, 2011
Printed, PDF
Page 95
1st paragraph

In text:

we now need to change our PlayerImpl to reflect...

te correct is:

we now need to change our TeamImpl to reflect...

Note from the Author or Editor:
This is correct, please make the change indicated.

Josivan de Souza  Nov 05, 2010  Sep 09, 2011
Printed
Page 169
5th-to-last line of code sample

Source code is wrong. The text and comment for the JUnit test method say it will increment the number of at-bats by 10 to "ensure that each test case has the minimum number of at-bats." This line:

numbats++;

Should probably be:

numbats += 10;

Note from the Author or Editor:
This is an error; the suggested fix is fine; please change the example code line reading
numbats++;
to
numbats += 10;

James Cook  Jul 01, 2010  Sep 09, 2011
PDF
Page 123
2nd paragraph

Any call to this method will need to be in a try catch block, with an exception handler supplied for the RemoteException.

Should be ellipses between try and catch

(This is a production error I made...)

Note from the Author or Editor:
Correct, please insert an ellipses between the "try" and "catch"

Kristen  Apr 26, 2010  Sep 09, 2011
PDF
Page 107
1st paragraph

So we will take the approach of saying that if a Player object does not fill a role, calling the get () method for that role on that Player object will return null.

Should be ellipses between get and ()

(This is a production error I made...)

Note from the Author or Editor:
This is an error, but the correct solution is to remove the space between get and the (), not insert an ellipses. So the correct text should be

...calling the get() method for that role...

with "get()" in a code font.

Kristen  Apr 26, 2010  Sep 09, 2011
PDF
Page 104
footnote

pg 104 (footnote)
If you really want to get a grasp on how to use generics, you will need to read the generics chapter in Josh
Bloch?s Effective Java (Prentice Hall) a couple of times.

Should be ellipses like so: (Prentice Hall)...a couple of times.

(This is a production error I made...)

Note from the Author or Editor:
This is correct, please insert the ellipses.

Kristen  Apr 26, 2010  Sep 09, 2011
PDF
Page 35
1st paragraph

If the way in which you are going to respond to an exception is tied not just to the exception but to the context in which the method raising the exception was called, the style of code in which each call is wrapped in a try catch clause may be needed.

Should be ellipses between try and catch

(This was a production error I made...)

Note from the Author or Editor:
This is correct; please insert the ellipses.

Kristen  Apr 26, 2010  Sep 09, 2011