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 2015”. 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.

11th Edition Volume 1 (Java SE 9 - 11)

Page xxi
Change “Then we guide you through compiling and running three typical Java programs—a console application, a graphical application, and an applet—using the plain JDK, a Java-enabled text editor, and a Java IDE.” to “Then we guide you through compiling and running a console application and a graphical application. You will see how to use the plain JDK, a Java IDE, and the JShell tool.”
Page 34
Change “You get a list of all methods that you can invoke on the generator variable:” to “You get a list of all methods that you can invoke with the Math class:”
Page 54
Change “Except, of course, when n is negative.” to “Except, of course, when n is odd and negative.”
Page 69
Change the method names empty and blank to isEmpty and isBlank.
Page 69
In the API note for the startsWith/endsWith methods, change “returns true if the string starts or ends with suffix.” to “returns true if the string starts with prefix or ends with suffix.”
Page 71
Change http://docs.oracle.com/javase/9/docs/api to https://docs.oracle.com/en/java/javase/11/docs/api
Page 72
Change jdk-9-docs to jdk-11-docs
Page 127
Change “A class is the template or blueprint from which objects are made. ” to “A class specifies how objects are made.”
Page 282
Remove the second bullet void setAccessible(boolean flag)
Page 329
In the second column, change Integer::valueOf(x) to Integer.valueOf(x) and Integer::sum(x, y) to Integer.sum(x, y)
Page 328
Change new LocalDate to LocalDate.of (2x)
Page 328
Change requireNonNullOrElse to requireNonNullElse, requireNonNullOrElseGet to requireNonNullElseGet
Page 340
Change Comparator.comparing(Person::getMiddleName(), Comparator.nullsFirst(. . .)) to Comparator.comparing(Person::getMiddleName, Comparator.nullsFirst(. . .))— that is, no parentheses after getMiddleName
Page 361
Change “Now add the names of the classes to a UTF-8 encoded text file in a file in the META-INF/services directory whose name matches the fully qualified class name.” to “Now add the names of the classes to a UTF-8 encoded text file in a file in the META-INF/services directory whose name matches the fully qualified interface name.”
Page 380
Change
String readData(BufferedReader in) throws FileFormatException
to
String readData(Scanner in) throws FileFormatException
Page 428
Change /opt/jdk-9.0.1/lib/modules to /opt/jdk-11.0.1/lib/modules
Page 453
Change Logger.global.info(. . .); to Logger.getGlobal().info(. . .);
Page 463
Change “a better job with the min method” to “a better job with the minmax method”. Change
public static <T extends Comparable<T>> T min(T[] a)
to
public static <T extends Comparable<T>> Pair<T> minmax(T[] a)
and
public static <T extends Comparable<? super T>> T min(T[] a) . . .
to
public static <T extends Comparable<? super T>> Pair<T> minmax(T[] a)
Page 496
In Figure 9.5, change ArrayQueue to ArrayDeque
Page 628 preferences/ImageViewer.java
Change line 60 from
node.put("image", image);      
to
if (image != null) node.put("image", image);
Page 446
Change public void CompletableFuture<String> to public CompletableFuture<String>
Page 453
Change
public static <T extends Throwable> void d 
   {
      do work
   }
to
public static <T extends Throwable> void doWork(T t) throws T // OK
{
   try
   {
      do work
   }
Page 511
Change “(a number between 0.0 and 1.0 that determines at what percentage of fullness the hash table will be rehashed into a larger one).” to “. If the ratio size/capacity exceeds the load factor, the hash table will be rehashed into a larger one.”
Page 624
Change “prorgram” to “program”
Page 624
Change java.util.preferences to java.util.prefs
Page 756, 768
Change private var to private Lock
Page 785 blockingQueue/BlockingQueueTest.java
Change e.g. /opt/jdk-9-src to e.g. /opt/jdk-11-src
Page 789
Change “The concurrent hash map can efficiently support a large number of readers and a fixed number of writers. By default, it is assumed that there are up to 16 simultaneous writer threads. There can be many more writer threads, but if more than 16 write at the same time, the others are temporarily blocked. You can specify a higher number in the constructor, but it is unlikely that you will need to.” to “The concurrent hash map can efficiently support a large number of readers and a bounded number of writers.”
Page 801
Change Integer result = task.get(); to Integer result = futureTask.get();
Page 820
Change the last entry in the second column of Table 12.4 to: “Complete after any of the given futures completes, yielding its result.”
Page 833
Change “Call builder.redirectIO() to make this setting for all three streams” to “Call builder.inheritIO() to make this setting for all three streams”
Page 834
Change process.waitfor(delay, TimeUnit.SECONDS) to process.waitFor(delay, TimeUnit.SECONDS)—an uppercase F in waitFor
Page 835
Change Process.current() to ProcessHandle.current()

11th Edition Volume 2 (Java SE 9 - 11)

Page 2, 4, 8, 23, 27, 45, 147
Change new String(Files.readAllBytes to Files.readString and remove the subsequent , StandardCharsets.UTF_8)
Page 65
For greater clarity, change the code block
var din = new DataInputStream(
   pbin = new PushbackInputStream(
      new BufferedInputStream(
         new FileInputStream("employee.dat"))));
to
var pbin = new PushbackInputStream(
   new BufferedInputStream(
      new FileInputStream("employee.dat")));
var din = new DataInputStream(pbin);
Page 71
Change
var content = new String(Files.readAllBytes(path), charset);
to
var content = Files.readString(path, charset);
Page 112
Change “If you want to read the file as a string, call readAllBytes followed by” to “As already mentioned in Section 2.1.6, you can read the content of a text file as”. Replace the code line that follows with
var content = Files.readString(path, charset)
Two times, change
Files.write(path, content.getBytes(charset)
to
Files.writeString(path, charset
and, for consistency, change
Files.write(path, lines);
to
Files.write(path, lines, charset);
Page 113
In the API note, add bullets below the first and third bullet respectively.
Page 146
Change String match = input.group(); to String match = matcher.group();
Page 407
Change

The default configuration file is located at

conf/logging.properties

(or at jre/lib/logging.properties prior to Java 9).

to

The default configuration file is located at jdk/conf/logging.properties (or at jre/lib/logging.properties prior to Java 9).

JavaFX Bonus Chapter Page 47
In Figure 13.15, switch Label and Labeled
JavaFX Bonus Chapter Page 94
Change
task.setOnFailed(event -> status.setText("Failed due to ") + task.getException());
to
task.setOnFailed(event -> status.setText("Failed due to " + task.getException()));

Thanks to Carlos Eduardo Villanueva Altuna, Jessica Cunningham, Inge Frissen, Pavlo Gotsonoga, Stephen Kalinin, Daniel King, Oleksii Klochko, Kendrew Lau, Ke Ma, Ivan Ponomarev, Eric Rybarczyk, Mark Summerfield, Andy Walsh, Eric Wang, Piotr Winiarek, Henry Yu, Hongyuan Zhang, 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:

Edition:
Page number:

Problem description:

To protect against spam robots, please answer this simple math problem:
* =