Also covers OCP Java SE 11 Developer Exam (1Z0-819)               

Errata

Please check here often as we will update the errata regularly.

You can either contact us directly (Khalid, Vasily) to report an error or you can post it on the PROGRAMMER CERTIFICATION (OCPJP) FORUM at Coderanch.
On the forum, just create a new thread and designate the subject to be "OCP Java 17 Programmer's Guide", together with the page number in the book.
We monitor the forum for any feedback.

Errata updates:

Date of updatePrintingPages
2023-04-201st1198
2023-05-091st1677
2023-07-161st29
2023-07-211st238
2023-08-071st516, 525, 526
2023-08-081st518
2023-08-251st1501
2023-09-041st943
2023-09-161st1071
2023-11-201st14, 22, 27, 1636
2024-01-021st22, 25
2024-03-051st1648

Acknowledgements:

Many thanks to the following readers for their diligent observations: Eric Borm, Valerio Cesolani, Michael Gualeni, Tinashe Muchada, Satish Singh, Ivan Titov.

Errata list:

The errors listed below are ordered according to their page numbers. Each error is labeled with all the printings where the error occurred. E.g. "1st printing" indicates that the error occurred in the first printing, but has been corrected before the second printing, i.e. you won't find this error in the second printing.

Page 14

1st printing, start of the last-but-one paragraph:

CHANGE:

It addition, the Point3D class...

TO:

In addition, the Point3D class...

Page 22

1st printing, replace the paragraph:

CHANGE:

Unlike the javac command, the name of the single source file (e.g., Demo-App.java) need not be a valid class name, but it must have the .java extension. Also unlike the javac command, the java command allows several public classes in the single source file (only public classes in the Demo-App.java file).

TO:

The name of the single source file (e.g., Demo-App.java) need not be a valid class name, but it must have the .java extension. Unlike the javac command, the java command allows several public classes in the single source file (only public classes in the Demo-App.java file).

1st printing, the third bullet should be deleted:

DELETE:

There must not exist class files corresponding to the class declarations in the single source file that are accessible by the java command.

Page 25

1st printing, at the end of the last paragraph:

INSERT:

Note that if a value is wider than the width specified in the format, then the width in the format is ignored.

Page 27

1st printing, in the review question 1.9:

CHANGE:

Select the one correct answer.

TO:

Select the two correct answers.

Page 29

1st printing, under Chapter Topics in Chapter 2, the word "boolean" is misspelt in the following bullet:

CHANGE:

Overview of primitive data types defined in Java: integral, floating-point, and boolgean

TO:

Overview of primitive data types defined in Java: integral, floating-point, and boolean

Page 238

1st printing, in the section Defining Interfaces:

CHANGE:

The access modifier can be public or private. Lack of an access modifier implies package accessibility.

TO:

The access modifier can be public. Lack of an access modifier implies package accessibility.

Page 516

1st printing, in the last sentence, the name of the non-static field should be nsf2 and not nsf1:

CHANGE:

The static field sf in the class TLCWith2LCS is accessed in the StaticLocal class at (14), but the non-static field nsf1 cannot be accessed, as shown at (13).

TO:

The static field sf in the class TLCWith2LCS is accessed in the StaticLocal class at (14), but the non-static field nsf2 cannot be accessed, as shown at (13).

Page 518

1st printing, in the output from Example 9.12:

CHANGE:

        Painter$1$Circle
        Painter$1$Graph

TO:

        Painter$1Circle
        Painter$1Graph

Page 525

1st printing, the second sentence in the subsection Accessing Local Declarations in the Enclosing Block:

CHANGE:

An anonymous class can only access (effectively) final variables in its enclosing local context, shown both for static fields at (10), (11), and (12), and for instance fields at (13), (14), and (15).

TO:

Local variables in the enclosing non-static method cannot be accessed in any static fields of an anonymous class, whether they are (effectively) final or not, as shown at (10), (11), and (12). An anonymous class can only access (effectively) final local variables in its enclosing local context from its instance fields, as shown at (13), (14), and (15).

Page 526

1st printing, in Example 9.15 (see the new explanation on page 525):

CHANGE:

        static int sff1 = fp;  // (10) Final param from enclosing method
        static int sff2 = flv; // (11) Effect. final variable from enclosing method

TO:

  //    static int sff1 = fp;  // (10) Final param from enclosing method
  //    static int sff2 = flv; // (11) Effect. final variable from enclosing method

Page 943

1st printing, in the subsection Querying an Optional:

CHANGE:

        <X extends Throwable> T orElseThrow(Supplier<? extends X> exceptionSupplier) throws X extends Throwable

TO:

        <X extends Throwable> T orElseThrow(Supplier<? extends X> exceptionSupplier) throws X

Page 1071

1st printing, in Example 17.7, logical error in the loop condition of the for(;;) loop:

CHANGE:

        time.plus(duration).isBefore(endTimeExclusive);

TO:

        time.isBefore(endTimeExclusive);

1st printing, in Example 17.7, the program output is missing a showtime:

CHANGE:

        Showtime (PT2H15M): 10:10
        Showtime (PT2H15M): 12:25
        Showtime (PT2H15M): 14:40
        Showtime (PT2H15M): 16:55
        Showtime (PT2H15M): 19:10
        Closing time: 23:00

TO:

        Showtime (PT2H15M): 10:10
        Showtime (PT2H15M): 12:25
        Showtime (PT2H15M): 14:40
        Showtime (PT2H15M): 16:55
        Showtime (PT2H15M): 19:10
        Showtime (PT2H15M): 21:25
        Closing time: 23:00

Page 1198

1st printing, in Figure 19.15:

CHANGE:

«module game»

TO:

«module name»

Page 1501

1st printing, in Figure 23.7:

CHANGE:

        CopyOnWriteArrayList<K,V>
        CopyOnWriteArraySet<K,V>

TO:

        CopyOnWriteArrayList<E>
        CopyOnWriteArraySet<E>

Page 1636

1st printing, option (c) is also correct for the review question 1.9:

CHANGE:

(a)

TO:

(a) and (c)

1st printing, in the annotated answer to the review question 1.9, the last sentence is not correct:

CHANGE:

Since it is specified that the source file is compiled creating a class file, (c) would not work.

TO:

It does not matter whether the source file has already been compiled, (c) will still work as the SmallProg.java file has the class definition.

Page 1648

1st printing, add to the explanation for Review Question 5.27:

INSERT:

Compiling the options in Eclipse with JDK 17 will not result in compile-time errors for (a), (b), and (e). Seems to be a bug. However, compiling the code on the command line with javac for JDK 17 will print errors that will back the explanation for the review question.

Page 1677

1st printing, answer to Review Question 15.20:

CHANGE:

(b)

TO:

(a)

Khalid A. Mughal   •   Vasily A. Strelnikov