Java for the Impatient

Bug Report Page


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, January 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.

Page 1
Change “five integral types, two floating-point types, and boolean” to “four integer types, two floating-point types, char, and boolean."
Page 17
char next = (char)('J' + 1); // Converts 75 to 'K'
int n = 1;
char next = (char)('J' + n); // Converts 75 to 'K'
Page 18
Change “There are two right shift operators: >> fills the top bits with zero, and >>> extends the sign bit into the top bits.” to There are two right shift operators: >> extends the sign bit into the top bits, and >>> fills the top bits with zero.
Page 34
done = false;
done = true;
Page 34, 35
Change if (n < 0) continue; to if (input < 0) continue;
Page 44
Change 3, 10, 11, 8 to 5, 10, 11, 8
Page 49 Exercise 7
Change 65535 to 4294967295, short to int, int to long, and “computes” to “computes and displays”
Page 50
Change 3 10 11 8 to 5 10 11 8
Page 76
Change “package scope” to “package access” (3x)
Page 81
Change myFace.enroll("fred") into myFace.enroll("Fred")
Page 108
Add a semicolon at the end of
Runnable task = () -> { for (int i = 0; i < 1000; i++) doWork(); }
Page 117
Change public class Application() to public class Application
Page 120
return (x, y) ->, y);
return (x, y) ->, x);
Page 137
public class ConcurrentWorker extends Greeter
public class ConcurrentWorker extends Worker
Page 138
Change “the null-safe alternative Object.equals(obj, other)” to “the null-safe alternative Objects.equals(obj, other)
Page 141
Change “Since the equals method overrides Objects.equals” to “Since the equals method overrides Object.equals
Page 184
ex.printStackTrace(new PrintStream(out));
Page 210
public void add(String e)
public boolean add(String e)
public void add(Object e) {
    add((String) e);
public boolean add(Object e) {
    return add((String) e);
Pages 218 and 224
public static <V, T> V doWork ... 
public static <V, T extends Throwable> V doWork ...
Page 241
byte[] toByteArray[] 
long[] toByteArray[]
byte[] toByteArray()
long[] toLongArray()
Page 244
Change “then Arrays.asList(a) returns a List<T>” to “then Arrays.asList(a) returns a List<E>
Page 255 and in the index (p. 458, 468)
Change getOrElse to orElse
Page 268
Change “is to use stay away” to “is to stay away”
Page 268
.filter(s -> s.length() < 10)
.filter(s -> s.length() < 12)
Page 290
Change “2. When a file or directory is encountered:” to “2. When a file is encountered:”
Page 302
Employee peter = new Employee("Fred", 90000);
Employee paul = new Manager("Barney", 105000);
Employee peter = new Employee("Peter", 90000);
Employee paul = new Manager("Paul", 105000);
Page 381
Change “by calling toNanos, toMillis, toSeconds, toMinutes” to “by calling toNanos, toMillis, getSeconds, toMinutes
Page 405
Change the caption of Table 13-4 to “Date and Time Formatting Styles”
Page 428
Change “an object of the JavaScript Greeter class” to “an object of the JavaScript SimpleGreeter class”.

Thanks to Craig Artley, Andrew Binstock, Richard Boyd, Ben Hadley, Alain Kreienbuhl, Tony Mathson, Aleksandr Morozov, Christoph Nahr, Stiu Principle, Hans-J. Schmid, Andrzej Stefanski, Matt Stavola, David Thiele, Suleiman Khan Tischhauser, Serguei Yanush, Mark Zarins, and (your name might go here) for their bug reports and suggestions!

Bug Report Form

Please use this form to report any bugs that you find. Please check the list of known bugs first before you report a bug. Unfortunately, I do not have the time to respond personally to every report, but I do read them all and will post updates to this page. Thank you!

Your name:

Your email address:

Page number:

Problem description:

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