# Welcome to the Core Java Bug List

- 10th Edition Volume 1 (Java SE 8)
- 10th Edition Volume 2 (Java SE 8)
- 9th Edition Volume 1 (Java SE 7)
- 9th Edition Volume 2 (Java SE 7)
- 8th Edition Volume 1 (Java SE 6)
- 8th Edition Volume 2 (Java SE 6)
- 7th Edition Volume 1 (Java SE 5.0)
- 7th Edition Volume 2 (Java SE 5.0)
- 6th Edition Volume 1 (Java SE 1.4)
- There was no 6th Edition Volume 2
- 5th Edition Volume 1 (Java SE 1.3)
- 5th Edition Volume 2 (Java SE 1.3/1.4)
- 4th Edition Volume 1 (Java SE 1.2)
- 4th Edition Volume 2 (Java SE 1.2)
- 3rd Edition (JDK 1.1)
- 2nd Edition (JDK 1.02)
- 1st Edition (JDK 1.0)

### 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.

## 10th Edition Volume 1 (Java SE 8)

[2] Page 51
  In the Caution note, change `\u00A0` to `\u000A`.
[2] Page 74
  Change “The API documentation is part of the JDK. It is in HTML format. Point your web browser to the docs/api/index.html subdirectory of your JDK installation (Figure 3.2).” to “You can download the API documentation from Oracle and save it locally, or you can point your browser to `http://docs.oracle.com/javase/8/docs/api` (Figure 3.2).”
[2] Page 89
  Change “Finally, there is a variant of the for loop that has no analog in C or C++. It is similar to the foreach loop in C#.” to “Finally, there is a variant of the for loop that is similar to the range-based `for` loop in C++ and the `foreach` loop in C#.”
[2] Page 150
  Change

      LocalDate hireDay = LocalDate.of(year, month, day);

  to

      hireDay = LocalDate.of(year, month, day);

[2] Page 173
  Change

      Employee(String name, double salary, int y, int m, int d)

  to

      public Employee(String n, double s, int year, int month, int day)

[2] Page 178
  Move step 3 before Step 1 in the numbered list, and change “the body of the second constructor is executed” to “the object is constructed with the second constructor before continuing with the body of this constructor”
[2] Page 183
  Change “For example, you can import all classes in the `java.util` package with the statement `import java.util.*;`” to “For example, you can import all classes in the `java.time` package with the statement `import java.time.*;`”
[2] Page 189
  Change the section heading “Package Scope” to “Package Access”
[2] Page 189
  Change “package visibility” to “package access”
[2] Page 230
  Change `Object.equals(hireDay, other.hireDay)` to `Objects.equals(hireDay, other.hireDay)`
[2] Page 243
  Change

      return super.hashCode() + 17 * new Double(bonus).hashCode();

  to

      return java.util.Objects.hash(super.hashCode(), bonus);

[2] Page 251
  Change `void set(int index, E obj)` to `E set(int index, E obj)` and “overwriting the previous contents” to “returning the previous contents.”
[2] Page 258
  Remove the semicolon after `public enum Size { SMALL, MEDIUM, LARGE, EXTRA_LARGE }`
[2] Page 290
  Change “package visibility” to “package access”
[2] Page 292
  Remove “for sorting an employee array”
Page 296
  Change “Although you cannot put instance fields or static methods in an interface” to “Although you cannot put instance fields in an interface,”
[2] Page 300
  Change “Consider another interface with a `getName` method:” to “Consider two interfaces with a `getName` method:” and change the code below to:

      interface Person
      {
         default String getName() { return ""; };
      }

      interface Named
      {
         default String getName() { return getClass().getName() + "_" + hashCode(); }
      }

Page 321
  Change the code on top of the page to the (even more contrived)

      class Greeter
      {
         public void greet(ActionEvent event)
         {
            System.out.println("Hello, " + event);
         }
      }

      class TimedGreeter extends Greeter
      {
         public void greet(ActionEvent event)
         {
            Timer t = new Timer(1000, super::greet);
            t.start();
         }
      }

[2] Page 323
  Change “It is also illegal to refer to variable” to “It is also illegal to refer to a variable”.
[2] Page 324
  Change `public class Application()` to `public class Application`
[2] Page 338
  Change “Since the secret access methods have package visibility” to “Since the secret methods have package access”
[2] Page 341
  Remove the paragraph “As we already mentioned...always the same value” above the note.
[2] Page 376
  Change

      try (Scanner in = new Scanner(new FileInputStream("/usr/share/dict/words"), "UTF-8")

  to

      try (Scanner in = new Scanner(new FileInputStream("/usr/share/dict/words"), "UTF-8"))

[2] Page 378
  Change

      StackTraceTest.factorial(StackTraceTest.java:18)
      StackTraceTest.main(StackTraceTest.java:34)
      factorial(2):
      StackTraceTest.factorial(StackTraceTest.java:18)
      StackTraceTest.factorial(StackTraceTest.java:24)
      StackTraceTest.main(StackTraceTest.java:34)
      factorial(1):
      StackTraceTest.factorial(StackTraceTest.java:18)
      StackTraceTest.factorial(StackTraceTest.java:24)
      StackTraceTest.factorial(StackTraceTest.java:24)
      StackTraceTest.main(StackTraceTest.java:34)

  to

      stackTrace.StackTraceTest.factorial(StackTraceTest.java:20)
      stackTrace.StackTraceTest.main(StackTraceTest.java:36)
      factorial(2):
      stackTrace.StackTraceTest.factorial(StackTraceTest.java:20)
      stackTrace.StackTraceTest.factorial(StackTraceTest.java:26)
      stackTrace.StackTraceTest.main(StackTraceTest.java:36)
      factorial(1):
      stackTrace.StackTraceTest.factorial(StackTraceTest.java:20)
      stackTrace.StackTraceTest.factorial(StackTraceTest.java:26)
      stackTrace.StackTraceTest.factorial(StackTraceTest.java:26)
      stackTrace.StackTraceTest.main(StackTraceTest.java:36)

[2] Page 393
  Change “At least up to Java SE 7” to “Up to Java SE 7”.
[2] Page 428
  Change “Suppose the DateInterval method also overrides the getSecond method:” to “Suppose the DateInterval class also overrides the getSecond method:”
[2] Page 428
  Change

      public void setSecond(Object second) { setSecond((Date) second); }

  to

      public void setSecond(Object second) { setSecond((LocalDate) second); }

  and change

      public LocalDate getSecond() { return (Date) super.getSecond().clone(); }

  to

      public LocalDate getSecond() { return (LocalDate) super.getSecond(); }

[2] Page 432
  Change

      for (t : ts) coll.add(t);

  to

      for (T t : ts) coll.add(t);

[2] Page 448
  Change

      PairAlg.swap(result); // OK--swapHelper captures wildcard type

  to

      PairAlg.swapHelper(result); // OK--swapHelper captures wildcard type

[2] Page 467
  Change `return = true;` to `return true;`
[2] Page 468
  Change `boolean add(Object element)` to `boolean add(E element)`
[2] Page 489
  Change `System.println` to `System.out.println`
[2] Page 492
  Change `descripion` to `description` in the `toString` method.
[2] Page 493
  Change `E pollLast` to `E pollLast()`
[2] Page 496
  Change `@version 1.01 2012-01-26` to `@version 1.02 2015-06-20`
[2] Page 497
  Change `int score = scores.get(id, 0);` to `int score = scores.getOrDefault(id, 0);`
[2] Page 498
  Change `@version 1.11 2012-01-26` to `@version 1.12 2015-06-21`
[2] Page 501
  Change “ if the key was previously absent” to “ if the key was previously absent (or mapped to `null`).”, and add the following to the API note:
  - `default V putIfAbsent(K key, V value)` 8

    If `key` is absent or associated with `null`, associates it with `value` and returns `null`. Otherwise returns the associated value.

[2] Page 510
  Change `List group2` to `List<Employee> group2`
[2] Page 513
  Change “The methods such as `get` and `put` are serialized” to “The methods such as `get` and `put` are synchronized”
Page 522
  Change “using a linear search if the element type implements the `RandomAccess` interface, and a binary search in all other cases” to “using a binary search if the element type implements the `RandomAccess` interface, and a linear search in all other cases”
[2] Page 523
  Change `Collections.replaceAll("C++", "Java");` to `Collections.replaceAll(words, "C++", "Java");`
[2] Page 529
  Change

      Enumeration<Employee> e = staff.elements();
      while (e.hasMoreElements())
      {
         Employee e = e.nextElement();
         . . .
      }

  to

      Enumeration<Employee> values = table.elements();
      while (values.hasMoreElements())
      {
         Employee e = values.nextElement();
      . . .
      }

[2] Page 550
  Add a bullet before “You can maximize a frame by calling”
[2] Page 551
  Change `@version 1.33 2007-05-12` to `@version 1.34 2015-06-16`
[2] Page 566
  Change `@version 1.33 2007-05-12` to `@version 1.34 2015-06-16`
[2] Page 576
  Change

      Rectangle2D bounds = sansbold14..getStringBounds(message, context);

  to

      Rectangle2D bounds = sansbold14.getStringBounds(message, context);

[2] Page 670
  Change

      faceCombo.getItemAt(faceCombo.setSelectedIndex()),

  to

      faceCombo.getItemAt(faceCombo.getSelectedIndex()),

[2] Page 680
  Change “When the user selects a menu” to “When the user selects a menu item”.
[2] Page 686
  Change

      cutAction.putValue(Action.MNEMONIC_KEY, new Integer('A'));

  to

      aboutAction.putValue(Action.MNEMONIC_KEY, new Integer('A'));

[2] Page 707
  Change "The GBC helper class is in Listing 12.12" to "The GBC helper class is in Listing 12.11"
[2] Page 889
  Change “must have must have” to “must have”
[2] Page 933
  Change “wrapped in an unchecked `ExecutionException`” to “wrapped in an `ExecutionException`”

## 10th Edition Volume 2 (Java SE 8)

Page 238
  Change “If the timeout value has been set for a socket, all subsequent read and write operations” to “If the timeout value has been set for a socket, all subsequent read operations”
Page 239
  Change `InterruptedIOException` to `SocketTimeoutException` (2x)

Thanks to Maxim Belyaev, Aaron Chen, Alexey Elin, Yasir Bajwa, Maxim Belyaev, Zuo Cheng, Gianni Fabriziani, Pavlo Gotsonoga, Dominik Gruntz, Detlef Herm, Justin Jia, Paul Orekhov, Liutauras Vilda, Henry Ying, Mehran Zare, Gaopeng 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:
* =

Back to the Core Java page.