Core Java

Bug Report Page

14th Edition Volume 1

Section 2.1.3
Change https://docs.oracle.com/en/java/javase/21/docs/api/search.html?q=%s to https://docs.oracle.com/en/java/javase/25/docs/api/search.html?q=%s
Section 3.6.7
Add static before String join(...) in the API note.
Section 3.7.1
Change “First first” to “First”
Section 3.7.2
Change “in Germany, the group separator is a period, not a comma” to “in Germany, the decimal separator is a comma, not a period”
Section 3.1
Remove “You compile the file with the command”
Section 3.5.1
In the EPUB, the second paragraph of the Note at the end of the section was lost, and in the print/PDF version, the computer font was lost. Here is the correct paragraph:

To get the standard results on those processors was slower. As a pragmatic compromise, Java 1.2 allowed extended precision for intermediate computations. The strictfp keyword was introduced to force portable results. Modern processors can carry out 64-bit arithmetic efficiently. As of Java 17, the virtual machine is again required to use standard 64-bit arithmetic, and the strictfp keyword is now obsolete.

Section 3.6.3
Change “In our case, we copy everything from the beginning up to, but not including, the comma.” to “In our case, we copy everything from the beginning up to, but not including, the exclamation point.”
Section 3.10.5
Change
    IO.print(switch (args[0])) {
        case "-a" -> "🏴‍☠️";
        case "-b" -> "🍺";
        case "-h" -> "Hello,";
        default -> args[0];
    }
to
    IO.print(switch (args[0]) {
        case "-a" -> "🏴‍☠️";
        case "-b" -> "🍺";
        case "-h" -> "Hello,";
        default -> args[0];
    })

Section 3.7.1 API notes for java.lang.IO. Add static to all methods.
Section 4.8.6 PackageDemo.java
Add
import static java.lang.IO.println;
// the static println method is defined in that class
and change IO.println to println
Section 4.10.7
Change
@see com.horstmann.corejava.Employee#<init>()
to
@see com.horstmann.corejava.Employee#Employee(String, double, int, int, int)
Section 5.1.9
Remove the following:

A useless instanceof pattern is a compile-time error:

Manager boss = . . .;
if (boss instanceof Employee e) . . . // ERROR: Of course it's an Employee
Also remove the Note that follows it. (This behavior has changed in Java 21. Now both types of instanceof can be “useless”, i.e. always true.)
Section 5.2.5
Change identityToString to toIdentityString (2x)
Section 5.3.1
Change “It you don’t” to “If you don’t”
Section 5.7
Change “For example, Size.SMALL.toString()” to “For example, Size.SMALL.name()
Section 5.9.2
Switch "on x-axis" and "on y-axis".
Section 6.3.7
Change
public static Pair longestRun(double[] values)
to
public static Range longestRun(double[] values)
and “the nested Pair class” to “the nested Range class”
Section 8.1.4
Change “(public static, in our case)” to “(such as public static)”
Section 8.1.5
Change minmax to min (2x)
Section 8.4.2
Change Pait<Manager> to Pair<Manager>
Section 8.5.6
Change new Pair<T>(new T(); new T()) to new Pair<T>(new T(), new T()) and Pair.makePair(String.class) to makePair(String.class)
Section 9.3.3
Change
java v1ch09.set.SetDemo gutenberg/alice30.txt
to
java v1ch09.SetDemo gutenberg/alice30.txt
Section 9.3.3
In the API documentation for newHashSet, change numMappings to numElements (2x)
Section 9.3.4
Change
java v1ch09.set.SetDemo gutenberg/crsto10.txt 100
to
java v1ch09.SetDemo gutenberg/crsto10.txt 100
Section 10.4.2
Change “the newThreadPerTaskExecutor method” to “the newVirtualThreadPerTaskExecutor method”
Section 10.4.3 Listing 10.3
Change “the number of times the word occurs in the given word” to “the number of times the word occurs in the given file”

14th Edition Volume 2

Section 4.3.3
Sadly, the postal service is sunsetting the zip code service covered in this section. To try out another service, use this post.properties file:
url=https://codecheck.io/run
Input=
Main.java=public class Main {\n\
    public static void main(String[] args) {\n\
        System.out.println("Hello, World!");\n\
    }\n\
}\n

Credits

Thanks to Tiru Bokka, Craig Davis, Taha Ghassemi, Amit Lamba, Stephen Lang, Dr John-Mark Odero, Michel (Mike) Rainville, Vincent Temmerman, John Westcroft, and (your name might go here) for their bug reports!

Prior Edition Errata

Bug Report Form

If you have found another bug in the book or in our code that is not mentioned in this bug list, then please send a report. Unfortunately, I cannot reply personally to each report, but I do read all your comments.

Your name:

Your email address:

Edition:
Section number:

Problem description:

To protect against spam robots, please answer this simple problem: What is printed by
IO.println( * )?