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 update | Printing | Pages |
---|---|---|
2023-04-20 | 1st | 1198 |
2023-05-09 | 1st | 1677 |
2023-07-16 | 1st | 29 |
2023-07-21 | 1st | 238 |
2023-08-07 | 1st | 516, 525, 526 |
2023-08-08 | 1st | 518 |
2023-08-25 | 1st | 1501 |
2023-09-04 | 1st | 943 |
2023-09-16 | 1st | 1071 |
2023-11-20 | 1st | 14, 22, 27, 1636 |
2024-01-02 | 1st | 22, 25 |
2024-03-05 | 1st | 1648 |
2024-07-22 | 1st | 216, 237 |
2024-11-16 | 1st | 30, 31, 32, 75 |
2024-11-29 | 1st | 108, 110, 114, 115, 134, 1641 |
2024-12-26 | 1st | 162, 180 |
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 30
1st printing, in subsection Identifiers:
CHANGE:
a keyword (Table 2.1, p.31)
TO:
a reserved keyword (Table 2.3, p.32)
Page 31
1st printing, in Table 2.1:
DELETE:
_ (underscore)
Page 32
1st printing, in Table 2.3:
INSERT:
_ (underscore)
Page 75
1st printing, at the end of section Relational Operators: <, <=, >, >=:
CHANGE:
Relational operators are nonassociative.
TO:
Although the relational operators are defined as left associative, this fact cannot be exploited.
CHANGE:
Since relational operators have left associativity, the evaluation ...
TO:
The evaluation ...
Page 108
1st printing, in section 3.5:
CHANGE:
The hash code of an object is an int value that uniquely identifies the object.
TO:
The hash code of an object is an int value that ideally identifies the object.
1st printing, in section 3.6, delete the 'j':
CHANGE:
methodA(int)j 1' 2': Number of parameters
TO:
methodA(int) 1' 2': Number of parameters
Page 110
1st printing, insert the following at the end of the last sentence in the second paragraph of the subsection The Default Constructor:
INSERT:
... or in an initialization block (§10.8, p.551)
Page 114
1st printing, in subsection Static Fields in Classes, change the name of the method:
CHANGE:
The print statement at (2) in the static method printCount() shows ...
TO:
The print statement at (2) in the static method printStatic() shows ...
Page 115
1st printing, in subsection Static Methods in Classes, change the name of the method:
CHANGE:
Example 3.6 shows how the static method printCount() of the class Light ...
TO:
Example 3.6 shows how the static method printStatic() of the class Light ...
Page 134
1st printing, towards the end of the subsection Passing Arrays:
CHANGE:
... will result in the swap() method at (3) to be invoked.
TO:
... will result in the swap() method at (3) being invoked.
1st printing, in the last sentence at the end of the subsection Passing Arrays:
INSERT:
... , as in the calls to the printIntArray() method in the main() method.
Page 162
1st printing, in subsection Using Strings as case Constants, change the line number:
CHANGE:
From the declaration at (2a), the compiler cannot guarantee that the value of the reference will not change at runtime.
TO:
From the declaration at (2b), the compiler cannot guarantee that the value of the reference will not change at runtime.
Page 180
1st printing, in section Labeled Statements, at the end of the section:
CHANGE:
A labeled statement is executed as if it were unlabeled, unless it is the break or continue statement.
TO:
A labeled statement is executed as if it were unlabeled, unless its label is the target label of a break or a continue statement.
Page 216
1st printing, in Review Question 5.3:
CHANGE:
class A { int max(int x, int y) { (x>y) ? x : y; } }
TO:
class A { int max(int x, int y) { return (x>y) ? x : y; } }
Page 237
1st printing, in Review Question 5.16, for class Animal:
CHANGE:
public static final MAX_SIZE = 10;
TO:
public static final int MAX_SIZE = 10;
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 1641
1st printing, annotated answer to the review question 3.13, in middle of the explanation:
CHANGE:
(a), (b), and (c) are fixed arity calls.
TO:
(a), (b), and (c) are variable arity calls.
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)