Welcome to the Core Java Bug List

How to Tell which Printing You Have

On the bottom of the copyright page (facing the first page of the table of contents), look for a line such as “First printing, December 2021”. In the errata below, we indicate the printing in which the error has been fixed inside square brackets such as [4].

For example, suppose you have the fourth printing. Then you can ignore all reports that are prefixed with [2], [3] or [4]. But you would want to pay attention to all reports that are prefixed with [5] or higher or that have no bracketed prefix at all.

12th Edition Volume 1 (Java SE 12 - 17)

Section 3.3.2
Change “dividing a positive number by 0” to “dividing a positive floating-point number by 0” and “Computing 0/0” to “Dividing 0.0 by 0”
Section 3.6.6
if (Character.isSupplementaryCodePoint(cp)) i += 2;
else i++;
to the simpler
i += Character.charCount(cp);
Section 3.7.1 API java.io..Console
Remove static from readPassword and readLine
Section 3.10.1
Change “the ith integer” to “the integer with index i
Section 4.4.5 Listing
int n = Employee.getNextId();
int n = Employee.advanceId();
Section 4.6.6
Change the C++ note to:

The this reference in Java is identical to the this pointer in C++. However, in C++, you call another constructor in the member initialization list:

Employee(double s) : Employee("Employee #" + nextId, s) { nextId++; }
Section 4.8.6
Change “You will see in Chapter 11” to “You will see in Section 4.9.1”
Section 5.1.3

is shorthand for “call the constructor of the Employee superclass with n, s, year, month, and day as parameters”


is shorthand for “call the constructor of the Employee superclass with name, salary, year, month, and day as arguments”

Section 5.9.3
Change javac resource/ResourcesTest.java to javac resources/ResourcesTest.java
Section 5.9.4 API java.lang.Class
Change “getDeclaredField returns an array” to “getDeclaredFields returns an array”
Section 6.1.6
Remove the semicolon after default String getName() { return ""; }
Section 6.3.2
Change the note at the end of the section to:

As of Java 16, inner classes can have static members. Previously, static methods in inner classes were disallowed, and static fields declared in an inner class had to be final and initialized with a compile-time constant.

Static methods of an inner class can access static fields and methods from the inner class or enclosing classes.

Section 7.1
Remove “Instead, as I mentioned back in Chapter 5, ”
Section 7.2.6
In the API notes for java.lang.StackWalker.StackFrame, change String getDeclaringClass() to Class<?> getDeclaringClass()
Section 7.4.2
java -ea:MyClass -ea:com.mycompany.mylib MyApp
java -ea:MyClass -ea:com.mycompany.mylib... MyApp
and “The option -ea... turns on” to “The option -ea:... turns on”
Section 8.6
Remove “The actual implementation...erasure makes it undetectable.” (Note: The implementation was changed to the way the book recommended.)
Section 12.4.6
Change Lock lock = new Object(); to Object lock = new Object();
Section 12.4.13
Change private static Holder to private static class Holder
Section 12.5.2 API Notes for java.util.concurrent.ConcurrentSkipListMap<K, V>
Change ConcurrentSkipListSet<K, V>(Comparator<? super K> comp) to ConcurrentSkipListMap<K, V>(Comparator<? super K> comp)
Section 12.5.7
Change Arrays.parallelSort(words.length / 2, words.length) to Arrays.parallelSort(words, words.length / 2, words.length)
Section 12.6.3 executors/ExecutorDemo.java
Add a closing parenthesis in line 117: + tpExecutor.getLargestPoolSize());

12th Edition Volume 2 (Java SE 12 - 17)

Section 1.3
Change sentence.codePointAt(i) to s.codePointAt(i) (2x)
Section 1.3
Change 2 times
if (Character.isSupplementaryCodePoint(cp)) i += 2;
else i++;
i += Character.charCount(cp);
Section 1.3
collector.accept(new String(new int [] { cp }, 0, 1));
Section 1.3
Change int cp = sentence.codePointAt(i); to int cp = s.codePointAt(i);
Section 1.11
Change new Result(list, avg) to new Pair(list, avg)
Section 2.1.1. API java.io.InputStream
In readNBytes remove “, or -1 at the end of the input stream”
Section 2.6
FileChannel = FileChannel.open(path);
FileChannel channel = FileChannel.open(path, StandardOpenOption.WRITE);
Section 2.1.7
Remove the line employees[i] = new Employee(); and change
employees[i] = readEmployee(in);
Section 2.2.2 randomAccess/RandomAccessTest.java
Remove the line newStaff[i] = new Employee();, change
newStaff[i] = readData(in);
newStaff[n - 1 - i] = readData(in);
new Employee(name, salary, y, m - 1, d)
new Employee(name, salary, y, m, d)
Section 2.4.7
Change “All methods except visitFileFailed do nothing and continue.” to “”
Section 4.3.2
In the API for java.net.URLConnection.getHeaderField, change “or null if n is < 0” to “or the response status line if n is 0 or null if n is < 0
Section 4.2.4
Change “See Chapter 1 for more information about NIO buffers.” to “See Chapter 2 for more information about NIO buffers.”
Section 4.4.4
Optional<String> lastModified = headerMap.firstValue("Last-Modified");
Optional<String> lastModified = responseHeaders.firstValue("Last-Modified");
Section 4.4.4 client/HttpClientTest.java
In the ofMimeMultipartData method, change all \n to \r\n, and add

Thanks to Umesh Berry, Dariusz Daćko, Ahmad Elkomey, Piyush Gupta, Zak Harris, Randy Henderson, Shao Jun, Oleksii Klochko, Suresh Kumar, Toreno Li, Saransh Mundepi, Marek Nowicki, Sy Pham, Nirav Pradhan, Satishchandra Singh, Zheng Song, Mingbao Sun, Eugene Shpak, Tommy Thomas, Jiulong Wang, Xiangaho Wang, Hongyuan Zhang, Liang Zhao, 冯橹宇, 黄兆彬, and (your name might go here) for their bug reports!

Bug Report Form

If you have found another bug in the book or in our code that is not mentioned in this bug list or the Core Java FAQ , 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:

Section number:

Problem description:

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