Errata

Head First Java

Errata for Head First Java

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.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

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

Version Location Description Submitted by Date submitted
Printed, PDF Page xxxv
2nd and 4th paragraph and photo captions

Names are spelled differently in the Text and the corresponding photos:
"Jef Cumps" vs "Jeff Cumps", "Marilym[sic?] de
Queiroz" vs "Marilyn de Queiroz"

Fritz Pick  Aug 02, 2022 
Printed, PDF Page 100
loop prep code ("REPEAT")

According to the prep code the "checkYourself"-method returns "miss" as soon as the userGuess doesn't match the cell in the current iteration of the loop, regardless if there is a match in the "locationCells"-array.
If this flaw in the code (returning miss from inside of "REPEAT") which may be intended to be found during testing (but the fake user guess in the test code matches the first cell so this issue wouldn't be found with the provided test code) is never explained.
The real code is completely different from the suggested prep code.

Fritz Pick  Jan 06, 2023 
PDF Page 290
bottom left

Its written "Integer iWrap = new Integer(i)", but this format is deprecated since Java 9. It should be updated to "Integer iWrap = i" or "Integer iWrap = Integer.valueof(i)".

aryan  Mar 17, 2024 
Printed, PDF Page 298
first half. String.format explanation.

After the format specifier there is a comma, which doesn't appear in the supposed output.

The code
String.format("I have %.2f, bugs to fix.", 476578.09876);

should produce "I have 476578.10, bugs to fix." but in the book the supposed output is "I have 476578.10 bugs to fix."

Fritz Pick  Feb 18, 2023 
Printed, PDF Page 301
%d decimal

The book states: "The argument must be compatible with an int, so that means only byte, short, int, and char[!] (or their wrapper types)."

It is not possible to pass a char to the format method together with %d.
It produces this error: "java.util.IllegalFormatConversionException: d != java.lang.Character"

Fritz Pick  Feb 18, 2023 
Printed, PDF Page 302
2nd half

The paragraph states "As you’ll see when we get to date formatting[...] Just know that in a minute, you’ll see how to be more specific about which format specifiers are applied to which arguments.".

This announced part of the book seems to be removed from the "Third Edition" so this statement doesn't make sense.

The paragraph should be reworded.

Fritz Pick  Feb 18, 2023 
Printed, PDF Page 308
Be the Compiler solution

The solution fixes an error (i.e. omitted round brackets --> "()") that doesn't exist in the exercise-code in the third edition.
On page 308 the constructor of the StaticSuper-class already has the round brackets that were missing (to be fixed) in the second edition of the book.

Fritz Pick  Feb 21, 2023 
Printed, PDF Page 418
Last statement of "Be The Compiler"-Solution

The corresponding statement on page 395 is:
"Function<String, Integer> f = (String s) -> s.length();"
and should be correct.

In the solutions (p418) the above statement is missing. Instead there is a fix for another statement which doesn't appear on page 395:
Function<String, Integer> f = () -> System.out.println("Some string");
"Should take a String parameter. Should return an int, but actually returns nothing."

Anonymous  Mar 11, 2023 
Printed, PDF Page 424
sample code and console output

The description for the console says there would be the following unreported exception:
"error: unreported exception MidiUnavailableException; must be caught or declared to be thrown"

This isn't the case since the corresponding sample code has an incomplete try/catch structure which produces the following compiler error:
"error: 'try' without 'catch', 'finally' or resource declarations"

Fritz  Mar 29, 2023 
Printed, PDF Page 440
bottom, reference to solution

It says "Both answers on page 457" but there is only the solution of the first exercise (the class diagrams) on page 457, but not the try/catch structures from the second exercise.

Fritz  Mar 29, 2023 
Printed, PDF Page 463
description of setDefaultCloseOperation call and passed argument

The description says: "this line makes the program quit as soon as you
close the window (if you leave this out it will
just sit there on the screen forever)"

According to the docs (Java 5-17) "The value is set to HIDE_ON_CLOSE by default." So if the line in question ("frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);") is left out, the window will disappear will the program keeps running.

Fritz  Mar 30, 2023 
Printed, PDF Page 534
numbered screenshots

Because of the large nontransparent dropshadows of the macOS-screenshots some GUI-parts are being overlapped and not visible.

Fritz  Apr 19, 2023