• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Errata for OCA/OCP Java SE 7 Programmer I & II Study Guide (K&B7)

 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Likes 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Because there isn't currently an errata for this book (because it's very recently released), we will use this thread to keep track of all mistakes you'll find in the book. So every reader has a nice overview and doesn't waste precious time studying for the exam.

When you post an erratum, please provide the page number and as much details as possible (which chapter/section/question, the first words of the paragraph,...). The more details you post, the easier it will be for others to track the error down and make the necessary adjustments.

Thank you! And good luck everyone with preparing for OCAJP7 and/or OCPJP7 exam!
Kind regards,
Roel

PS. If you want to discuss an erratum or are unsure about something you read being an erratum, please open a seperate thread. So this thread will have only the errata. That's easier for other readers/ranchers: they only have to check the seperate posts and make appropriate changes to their book and not scroll to a bunch of other posts.

A little change of plans: Because errata in this thread are posted when discovered, they are in a random order. That makes it a lot harder and more time consuming to loop through all errata. That's why a (seperate) wiki-page was created with an overview of all K&B7 errata. This overview is ordered on chapter and page. If you have found a mistake in the book which isn't in this list yet or doubt about a possible mistake, just post a reply here. Once it is confirmed, it will be added to the overview. You can find the errata overview here. Happy studying!


[edit] added link to errata overview (on seperate wiki-page)
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chapter 1 Self Test Q9 (page 79)

In the code snippet the opening curly brace of class Frodo is missing.

Currently: 4. public class Frodo extends Hobbit

Should be: 4. public class Frodo extends Hobbit {

Confirmed & added to the errata overview.
 
Kaspar von Gunten
Greenhorn
Posts: 3
Android Eclipse IDE Java
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A minor mark-up Error in the "Two Minute Drill" at end of Chapter 3, Section"Garbage Collection":

Bullet point currently says:
The Class object has a finalize() method.

Should be:
The class Object has a finalize() method.


(Statement is about the Object class and not about an instance of the Class class).
 
Brian Mackin
Greenhorn
Posts: 5
Eclipse IDE Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On page 131, Table 2-4, "public Foo()" in the 3rd cell in the Compiler-Generated Constructor Code section should be bold type to reflect that it is compiler generated.
 
Saber Seddik
Greenhorn
Posts: 4
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Page 156 the grid including code fragments is missing the closing paranthese.
 
Kaspar von Gunten
Greenhorn
Posts: 3
Android Eclipse IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chapter 7, Self Test, Question 11:

All Answers that include "Runtime Exception c" are probably "copy paste" leftovers from Question 10, the example code does NOT contain any "RuntimeException c" (but the code of Question 10 does), only "Runtime Exception a".
 
Kaspar von Gunten
Greenhorn
Posts: 3
Android Eclipse IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kindle Edition, Chapter 7, Working with Java 7 Exception Handling, Section "Rethrowing Exceptions":

The second code sample (just above "Notice the multi-catch is gone...") shows completely unrelated code without any Exception handling.

This just seems to be a Kindle Edition problem, the code snippet is correct on the corresponding page 393 of the PDF Edition of the book.
 
Douglas Cyporyn
Greenhorn
Posts: 21
4
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chapter 3 Self Test, Question 3.

Answer choices are A, B, C, D, E, F.

Self Test Answers for question 3 list possible Answers A, B, C, D, E, G.

Clearly the answer key is describing answer F but referring to it as G.
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kaspar von Gunten wrote:A minor mark-up Error in the "Two Minute Drill" at end of Chapter 3, Section"Garbage Collection"

Added to the errata overview.

Brian Mackin wrote:On page 131, Table 2-4, "public Foo()" in the 3rd cell in the Compiler-Generated Constructor Code section should be bold type to reflect that it is compiler generated.

Added to the errata overview.

Saber Seddik wrote:Page 156 the grid including code fragments is missing the closing paranthese.

Added to the errata overview.

Kaspar von Gunten wrote:Chapter 7, Self Test, Question 11

Added to the errata overview.

Kaspar von Gunten wrote:Kindle Edition, Chapter 7, Working with Java 7 Exception Handling, Section "Rethrowing Exceptions"

Added to the errata overview.

Douglas Cyporyn wrote:Chapter 3 Self Test, Question 3

Added to the errata overview.
 
Douglas Cyporyn
Greenhorn
Posts: 21
4
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chapter 6: Flow Control and Exceptions, page 350

Fourth sentence in the last paragraph states:

When an Error or a subclass of Error (like RuntimeException) is thrown, it's unchecked.


This is confusing me because it makes it sound like RuntimeException is a subclass of Error. RuntimeException is not a subclass of error. Or, is it?

Thanks,
Doug
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Douglas Cyporyn wrote:This is confusing me because it makes it sound like RuntimeException is a subclass of Error. RuntimeException is not a subclass of error. Or, is it?

That's indeed confusing, because the parent class of RuntimeException is Exception, not Error.

This statement should be changed to something like: When an Error or a subclass of Error (like StackOverflowError) is thrown, it's unchecked.

That's definitely another erratum.
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Douglas Cyporyn wrote:Chapter 6: Flow Control and Exceptions, page 350

Fourth sentence in the last paragraph states

Roel De Nijs wrote:That's definitely another erratum.

Added to the errata overview.
 
James Pittendreigh
Ranch Hand
Posts: 35
1
Java Linux Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
P510, chapter 9.
"and only pass Filetimes"

Should be...
"and only pass FileTimes"

I.e, the class in discussion is java.nio.file.attribute.FileTime not Filetime.

Great book so far
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
James Pittendreigh wrote:P510, chapter 9.
"and only pass Filetimes"

Should be...
"and only pass FileTimes"

Good spot! Added to the errata overview.
 
Bernhard Goetz
Ranch Hand
Posts: 57
1
Java Netbeans IDE Oracle
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chapter 8, "The Date Class", Table 8-1, Page 421, Use Case #3 - Steps:
 
D Tom
Greenhorn
Posts: 9
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chapter 8, self test question 3.

Which invocation(s) will produce the output: 0 2 4 8 ?

The correct answer in the self test answers is B which is java Quetico "\B" "^23 *$76 bc"

But when I tried this, I got 0 2 4 5 7 10.



So I think the answer should be E, none of the above.
 
James Pittendreigh
Ranch Hand
Posts: 35
1
Java Linux Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Captain pedant back again, only another minor font/case issue:

p497:
Creating Files and Directories
With I/O, we saw that a File doesn't exist just because you have a File object.
Should be
Creating Files and Directories
With I/O, we saw that a file doesn't exist just because you have a File object.

file as in file on a file system as opposed to a File object.
 
Mohana Avu
Greenhorn
Posts: 7
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chapter 11 Generics and Collection (Q&A SelfTest )
Question 1 : Answer lists Answer A is correct in Kindle Edition

It should be Answer B. List<List<Integer>> table = new ArrayList<List<Integer>>(); Answer B is Correct.

 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bernhard Goetz wrote:Chapter 8, "The Date Class", Table 8-1, Page 421, Use Case #3 - Steps:

Added to the errata overview.
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
D Tom wrote:Chapter 8, self test question 3.

Added to the errata overview.
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mohana Avu wrote:Chapter 11 Generics and Collection (Q&A SelfTest )
Question 1 : Answer lists Answer A is correct in Kindle Edition

Added to the errata overview.
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
James Pittendreigh wrote:p497:
Creating Files and Directories

Added to the errata overview.
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Et voila, my work is done! The errata overview is up-to-date again, all new reported errata (4) were added.

Now time for me to go
 
Cristian Braun
Greenhorn
Posts: 1
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
safaribooksonline version, in section Part I OCA and OCP/1 Declarations and Access Control/Define Classes (OCA Objectives 1.2, 1.3, 1.4, 6.6, and 7.6)/Using the javac and java commands:
K&B7 wrote:java [options] class [args]


IMHO it should be:



since

is a valid command and the book gives a similar example for javac:

K&B7 wrote:javac [options] [source files]

K&B7 wrote:javac -help

 
Shawn Nicolson
Greenhorn
Posts: 2
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Douglas Cyporyn wrote:Chapter 3 Self Test, Question 3.

Answer choices are A, B, C, D, E, F.

Self Test Answers for question 3 list possible Answers A, B, C, D, E, G.

Clearly the answer key is describing answer F but referring to it as G.


In the ErrataKB7 it now shows that all answer options are incorrect; "A, B, C, D, E, and F are incorrect". As line C will not compile, C is an incorrect, incorrect answer, because line C has an incorrect integer literal.

Now that is as clear as mud what I'm actually saying is; C is the correct answer and should not be listed as the incorrect answer.

First post but not the first reading of this very fine site.
 
James Pittendreigh
Ranch Hand
Posts: 35
1
Java Linux Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another little formatting one, hopefully will be of some use to KS and BB....

P508, chapter 9:

Table9-6: has the headers:
Description | I/O Approach | Approach

which should be
Description | I/O Approach | NIO.2 Approach
 
Chris Heinz
Greenhorn
Posts: 29
1
Eclipse IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chapter 15, page 850.

The figure on this page is a figure from Chapter 9, page 494. I believe the figure on pg 850 should've been the table that they reference in the first paragraph on pg 850, "Looking at the last two rows of this table, you can see that the Book with the ISBN 9780545236 has two authors: author id 1008 (Mary Rodgers) and 1009 (Heather Hatch)."

I can not find the table that shows two authors for one book, so I assume that is what was meant to be here, on page 850.
 
Thomas Hauck
Ranch Hand
Posts: 95
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
At the start of "Chapter 14 Concurrency" on Page 785:

Second bullet point down the following is written:

java.util.cuncurrent.locks

When it should be written as
java.util.concurrent.locks

Use Lock, ReadWriteLock, and ReentrantLock Classes in the
java.util.concurrent.locks Package to Support Lock-Free Thread-Safe Programming on Single Variables
 
Sergey Butenko
Greenhorn
Posts: 6
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

Chapter 7, page 399: "What happens if we call the close() multiple times? It depends. For classes that implement AutoCloseable, the implementation is required to be idempotent. Which means you can call close() all day and nothing will happen the second time and beyond. It will not attempt to close the resourse again and it will not blow up. For classes that implement Closeable, there is no such guarantee.


Oracle documentation (Java SE7), Interface AutoCloseable: "Note that unlike the close method of Closeable, this close method is not required to be idempotent. In other words, calling this close method more than once may have some visible side effect, unlike Closeable.close which is required to have no effect if called more than once. However, implementers of this interface are strongly encouraged to make their close methods idempotent."
http://docs.oracle.com/javase/7/docs/api/java/lang/AutoCloseable.html
 
Sergey Butenko
Greenhorn
Posts: 6
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sergey Butenko wrote:Hi everyone,

Chapter 7, page 399: "What happens if we call the close() multiple times? It depends. For classes that implement AutoCloseable, the implementation is required to be idempotent. Which means you can call close() all day and nothing will happen the second time and beyond. It will not attempt to close the resourse again and it will not blow up. For classes that implement Closeable, there is no such guarantee.


Oracle documentation (Java SE7), Interface AutoCloseable: "Note that unlike the close method of Closeable, this close method is not required to be idempotent. In other words, calling this close method more than once may have some visible side effect, unlike Closeable.close which is required to have no effect if called more than once. However, implementers of this interface are strongly encouraged to make their close methods idempotent."
http://docs.oracle.com/javase/7/docs/api/java/lang/AutoCloseable.html


the same incorrect statements are on page 400 (table 7-5 comparing Closable and AutoClosable) and on page 405 (two-minute drill, "Autoclosable Resources with a try-with-resources statement", 3rd bullet from top)
 
Morten Banzon
Greenhorn
Posts: 1
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chapter 9, page 511, last paragraph :

If you forget and use the String " readOnly ," Java will silently ignore the statement and the file will still allow anyone to write to it.


I believe 'silently ignore' is incorrect. File 'a' exists and :



prints:



Tested with JDK 1.7.0_51
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cristian Braun wrote:safaribooksonline version, in section Part I OCA and OCP/1 Declarations and Access Control/Define Classes (OCA Objectives 1.2, 1.3, 1.4, 6.6, and 7.6)/Using the javac and java commands:
K&B7 wrote:java [options] class [args]


IMHO it should be:


Added to the errata overview.

Note: the official Oracle documentation about the java command also uses java [ options ] class [ arguments ] (as it's currently mentioned in the book).
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shawn Nicolson wrote:In the ErrataKB7 it now shows that all answer options are incorrect;

Now that is as clear as mud what I'm actually saying is; C is the correct answer and should not be listed as the incorrect answer.

That was obviously a stupid copy/paste error of mine. Apologies! I updated the item in the errata overview. Thanks for bringing this up!
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
James Pittendreigh wrote:Another little formatting one, hopefully will be of some use to KS and BB....

P508, chapter 9:

Added to the errata overview.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic