Errata

Learning Java

Errata for Learning Java, Fifth Edition

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
Page 4
1st paragraph

becOme => becAme (past simple tense)

Note from the Author or Editor:
Good catch! The current tense is indeed wrong. We'll get this fix into the next edition.

(More context for the typo: current, incorrect phrase around line 4 of first para: "Java also become one focus". As submitted noted, should be "Java also became one focus".)

Andrei Tereshko  Jan 25, 2022 
Printed
Page 29
Line #15 (first command in section "Installing OpenJDK on Linux")

The command to extract missing the option "x" (instead uses option "t")
Correct:
sudo tar xvf openjdk-13.0.1_linux-x64_bin.tar.gz

Incorrect (in the book):
sudo tar tvf openjdk-13.0.1_linux-x64_bin.tar.gz

Note from the Author or Editor:
Good catch! The extraction should indeed use 'x' instead of the 't' listing option. As noted in the erratum submission, this is the correct line:

sudo tar xvf openjdk-13.0.1_linux-x64_bin.tar.gz

Srini Nagul  Dec 25, 2020 
Page 115
First Sentence on Array Creation and Initialization

"Thenew is used to create..." the keyword new should be separated from the determiner (or definite article) 'the'.

Note from the Author or Editor:
Correct. A space is missing between "The" and "new". This will be corrected in the next edition.

Justine Ang  Feb 25, 2022 
Page 118
Fourth Paraghraph

java.util.ArrayscopyOf(). The lack of space between java.util.Arrays and copyOf() would mean that it's one thing at first glance until you see the example.

Note from the Author or Editor:
Good catch. There should be either a space or a dot separating "java.util.Arrays" and "copyOf()". This typo appears in the print version as well and will be corrected in the next edition.

Justine Ang  Feb 25, 2022 
PDF
Page 131
1st paragraph, code comment

Comments in the code example have typo: currently shows: "Comple-time error" but should read "Compile-time error"

Note from the Author or Editor:
Page 131, lines 4 and 6 both need the spelling correction noted by Marcus. "Comple-time" should be spelled "Compile-time" on both lines.

Marcus  Feb 23, 2021 
PDF
Page 139
3rd code example, just prior to last paragraph

Code comment/explanation currently reads as "// Still a compile-time error, foo may not be initialized" but based on the code, the explanation should say 'bar' instead of 'foo'
--This error may be confusing to readers as 'foo' is not part of the sample code

Note from the Author or Editor:
Second code example under the heading "Initializing Local Variables", last line of code has a comment that should use the variable name "bar" instead of "foo". That corrected line in its entirety should be:

bar += 1; // Still a compile-time error, bar may not be initialized

Marcus  Feb 23, 2021 
Page 164
3rd and 4th paragraph

"Class Animal" should be "class Animal". Keyword "class" must be lower case.

Note from the Author or Editor:
Good catch! The code snippets involving both Animal and Brain should indeed use the proper, lower-cased keyword "class". We'll get this corrected in the next edition.

Anonymous  Mar 19, 2022 
Page 215
first paragraph

The last sentence of p214, continuing on p215 says: "supposing an ObjectList extends a DateList type". However, I would expect that a DateList extends an ObjectList type and not the other way around. The following sentence "Now, you might object that ..." I do not understand at all. Could this be clarified?

Note from the Author or Editor:
Agreed. This paragraph will be reworked in the next edition.

Anonymous  Mar 27, 2022 
Page 223
first paragraph, first sentence

The first sentence ends with: "... and the use of threads.", but threads seem to be discussed in chapter 9.

Note from the Author or Editor:
Good catch. The chapter on threads was indeed moved from the 4th edition.

Floris Jan Sicking  Mar 30, 2022 
Printed
Page 237
Line#24 (first expression under "Alternation" section)

Line#24 (first expression under "Alternation" section) gives regex incorrectly as below:
Incorrect(in book):
\w+, \w+ \d+ \d+|\d\d/\d\d/\d\d //pattern 1 pattern 2

In this expression, the left matches patterns such as Fri, Oct 12, 2001, and the
right matches 10/12/2001.

Correct regex below:
\w+, \w+ \d+, \d+|\d\d/\d\d/\d\d\d\d //pattern 1 pattern 2

In this expression, the left matches patterns such as Fri, Oct 12, 2001, and the
right matches 10/12/2001.

Note from the Author or Editor:
Ah, yes. Good catch. Either the text description should have mentioned a two-digit year (e.g. 10/12/01) or the regular expression should include four digits as Srini suggests.

Srini Nagul  Jan 01, 2021 
Page 289
last code block

The code uses a GridLayout, but the figures showing the results on page 290 are for a FlowLayout.

Note from the Author or Editor:
Good catch. The second line of code inside the main() method should read:

frame.setLayout(new FlowLayout());

This will be corrected in the next edition.

Anonymous  Apr 15, 2022 
Page 290
code block beneath figure 10-3

Code "basic.setBackgroundColor(Color.YELLOW)": compilation cannot find the method "setBackgroundColor(Color)". Method "basic.setBackground(Color)" works ok.

Note from the Author or Editor:
Correct. Both calls to setBackgroundColor() should be setBackground(). This will be corrected in the next edition.

Anonymous  Apr 15, 2022 
Page 308
first paragraph

"We then pick a starting size for the window and add our actual label component, the frame (.....)." I cannot understand what is meant by the trailing "the frame".

Note from the Author or Editor:
Yes, the comma after the word "component" should be replaced with the (separate) word "to". I.e. "add our actual label component to the frame".

Anonymous  Apr 18, 2022 
Page 339
3rd paragraph

JCheckboxMenuItem must be JCheckBoxMenuItem (uppercase B).

Note from the Author or Editor:
Good catch. It should indeed be "Box". This will be corrected in the next edition.

Anonymous  Apr 26, 2022 
Page 348
4th paragraph code block

Variable "inReader" must be "charsIn".

Note from the Author or Editor:
Good catch. This will be corrected in the next edition.

Anonymous  Apr 30, 2022 
Page 362
3rd paragraph

Code does not compile:
- Statement "FileSystem zipfs = FileSystems.newFileSystem(zipURI, props) );" seems to have an extra closing parenthesis.
- Statement may throw an IOException. Within a try block it compiles and works.

Note from the Author or Editor:
The extra parenthesis is definitely a mistake. That will be fixed in the next edition along with better wording regarding the possibility of IOExceptions on many of the methods discussed.

Anonymous  May 08, 2022 
Page 380
3rd paragraph

Page 380
https://oreil.ly/M6kQg directed the link to "Java Swing, 2nd Edition (9780596004088)"

According to the content, the correct link should be directed to "Java Network Programming (9781449357672)

Could you please produce oreil.ly 's shorten link ?

Note from the Author or Editor:
Good catch! The shortened link on p. 380 does indeed end on the wrong book. The correct destination is:

https://learning.oreilly.com/library/view/java-network-programming/9781449365936/

I'll reach out to my editors and see about getting this link fixed online and for future editions.

Sophia  Oct 08, 2021 
Page 399
first code block

When the URL for sameDoc is printed, there is no slash between the host and path components. Path needs a leading slash.

Note from the Author or Editor:
Good catch. This will be corrected in the next edition.

Anonymous  May 14, 2022 
Page 414
second paragraph from below

Spelling error: probeConentType()

Note from the Author or Editor:
Good catch. This will be corrected in the next edition.

Anonymous  May 20, 2022 
Page 416
last paragraph

request method getExtraPath() must be getPathInfo().

Note from the Author or Editor:
Good catch. This will be corrected in the next edition.

Anonymous  May 28, 2022 
Page 418
code block continuing from page 417

Closing html tags: "</li>", "</ul>", "</body>" and "</html>" are not printed.

Note from the Author or Editor:
Definitely missing the tags. This will be corrected in the next edition.

Anonymous  May 28, 2022