Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Errata for OCA 8 Programmer I Study Guide (Sybex)

 
Greenhorn
Posts: 15
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Hello fellow coders,

Please note my book comes from the Certification Kit (OCA+OCP). I guess this is kind of a "2nd edition" as many errata mentioned here seem to have been corrected.
I hope I am not being too nit-picky and I haven't made any mistakes...


Introduction

Page : xxxix, #4
Error : In bullets 3, 5 and 7, "y taking a new value of ..." should be "count taking a new vale of ..."
Error : In bullet 3, "= (1 + 4) % 3" was corrected to "= (1 + 5) % 3"; but the real error was on the next line which should be "= 5 % 3" instead of "= 4 % 3"

Page : xli, #10
Error : "Reference one points to g1" should be "Reference one points to g2" (error on the errata page too)


Chapter 1

Page : 20, line 2
Error : "initialized" should maybe be replaced by "declared"


Chapter 2

Page : 55, note line 2
Error : "floating-point integers" should be replaced by "floating-point numbers"

Page : 57, lines 3 & 4
Error : in my book "multiplied" was replaced by "divided" in the first sentence, so instead of correcting an error a new one was added


Chapter 3

Page : 107, line 2
Error : method signature should be : "int indexOf(int ch, int fromIndex)" (my book shows "int indexOf(char ch, int fromIndex)", the other one has been corrected)

Page : 110, trim()
Error : why does this specific method signature include the access modifier whereas all others omit it ? (this can be confusing)

Page : 127, line 5
Error : there's

Page : 131, lines 4 & 13
Error : "boolean" should be "Boolean"


Chapter 4

Page : 169
Error : not really an error but a precision here : the return statement can (and should) be omitted if it would otherwise be unreachable. For example :


Chapter 5

Page : 247, line 19
Error : "Wolf overrides the parent class Canine" should be "Wolf extends the parent class Canine"

Page : 267, #4
Error : "marking a method" should be "marking an interface"


Chapter 1 mock explanation

Page : 335, #12
Error : if this question were about instance variables, option C would also be correct (Object defaults to null)


Chapter 2 mock explanation

Page : 338, #18
Error : "The expression on line 5" should be "The expression on line 6"


Chapter 4 mock explanation

Page : 344, #9
Error : I am not sure about option C : shouldn't the accessor be named "getNumberWings" in order to be correct ? Is shortening really allowed ?


Chapter 5 mock explanation

Page : 349, #17
Error : shouldn't the answer be B and C ? I have tried to compile the code and here is the output :
What should I answer if I stumble upon such a question on the real exam ?


Chapter 6 mock explanation

Page : 351, #18
Error : I think A should not be a valid option as the question makes a clear distinction between "allowed" and "required"
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

Please note my book comes from the Certification Kit (OCA+OCP). I guess this is kind of a "2nd edition" as many errata mentioned here seem to have been corrected.


This is great to hear.  We knew the publisher was doing a second printing with the errata corrected, but didn't know when it was coming out. The fact that it is in your hands answers that question!

Have a cow for all the comments. We'd rather get more feedback rather than less.

Page : xxxix, #4
Error : In bullets 3, 5 and 7, "y taking a new value of ..." should be "count taking a new vale of ..."


No, the book is correct. "y" is correct. The count and y variables get different values. In particular, count is just incremented by 1. Whereas y has the results of math assigned to it. Which is what the bullets describe.

Error : In bullet 3, "= (1 + 4) % 3" was corrected to "= (1 + 5) % 3"; but the real error was on the next line which should be "= 5 % 3" instead of "= 4 % 3"


You are correct. Congratulations on reporting the first "second printing" errata! Logged.

Page : xli, #10
Error : "Reference one points to g1" should be "Reference one points to g2" (error on the errata page too)


Correct. As you noted, it is in the errata. We didn't get that one to Wiley so it didn't get corrected.


Page : 20, line 2
Error : "initialized" should maybe be replaced by "declared"


The books is correct. While you can't refer to a variable before it has been declared, that's not the point we are making here. We are explaining why this code doesn't compile:


Page : 55, note line 2
Error : "floating-point integers" should be replaced by "floating-point numbers"


You are correct. There is no such thing as a floating-point integer! Added to errata.

Page : 57, lines 3 & 4
Error : in my book "multiplied" was replaced by "divided" in the first sentence, so instead of correcting an error a new one was added


The sentence we are talking about is "The result of x * y will then be automatically promoted to a double, so that it can be divided with z, resulting in a double value", right? If so, this is correct.
The code is x * y / z. So the result of the multiplication is being divided by z.

Page : 107, line 2
Error : method signature should be : "int indexOf(int ch, int fromIndex)" (my book shows "int indexOf(char ch, int fromIndex)", the other one has been corrected)


Thanks. They tried to fix it at least!

Page : 110, trim()
Error : why does this specific method signature include the access modifier whereas all others omit it ? (this can be confusing)


Noted. We have a private list of things that aren't wrong per se, but could be better.

Page : 127, line 5
Error : there's


Added to errata

Page : 131, lines 4 & 13
Error : "boolean" should be "Boolean"


Noted on our private list. With auto-boxing it doesn't really matter, but it would be clearer.

Page : 169
Error : not really an error but a precision here : the return statement can (and should) be omitted if it would otherwise be unreachable. For example :
?
1
2
3
int foo() {
 throw new NullPointerException();
}


That is true. It's omitted because we haven't covered exceptions/unreachable code yet at this point in the book. It's also out of scope for the exam.

Page : 247, line 19
Error : "Wolf overrides the parent class Canine" should be "Wolf extends the parent class Canine"


I think we meant overrides a method in. I added it to our private list. While it is wrong, it was more of an explanation thing. And the idea is at least clear.

Page : 267, #4
Error : "marking a method" should be "marking an interface"


I don't see this. #4 does say marking an interface. #5 says marking a method, but that one is about methods.


Replying to the mock exam ones in a separate post.
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

Page : 335, #12
Error : if this question were about instance variables, option C would also be correct (Object defaults to null)


You are correct. Good observation. Added to errata.

Page : 338, #18
Error : "The expression on line 5" should be "The expression on line 6"

You are correct again. Added to errata



Page : 344, #9
Error : I am not sure about option C : shouldn't the accessor be named "getNumberWings" in order to be correct ? Is shortening really allowed ?


It is allowed. There isn't a rule that the method and variable names need to match.

Page : 349, #17
Error : shouldn't the answer be B and C ? I have tried to compile the code and here is the output :
What should I answer if I stumble upon such a question on the real exam ?

       
It depends on your compiler. Some stop earlier. Our private list says to change the form of the question to "what is the first line not to compile." On the real exam, they tell you how many answers are correct so this situation doesn't arise.

Page : 351, #18
Error : I think A should not be a valid option as the question makes a clear distinction between "allowed" and "required"


Others took issue with this too. It's an English problem. While I don't think it is wrong, so many people did that it clearly is confusing so we'd rewrite that question in a Java 9 edition.
 
Author
Posts: 42
7
Android Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Not sure if these have been already corrected (at least, they are not in the errata on selikoff.net), so here are my $.02:

Introduction, page xxxviii, Q17, option D, closing parenthesis is missing.
Introduction, page xxxix, explanation to Q3, reads: 'in the parent class Cougar' -> should be Puma
page 95, Q6: LOC 6 and option B are inconsistent: 'Just right' vs. 'Just Right'
page 126, reads: 'which half the target it IS' -> 'which half the target is IN' ?
page 127: refvar declared as 'differentSize' -> inconsistent with 'differentSizes' in the picture on page 128
page 138: System.out.println(numbers); [5, 81, 99] -> missing // in between the stat and its output
page 138: 'California is three hours earlier than New York…' -> er… 'is 3 hrs BEHIND New York'?
page 139: 'This time displays hours, minutes, seconds, and nanoseconds.' -> Yes, I admit that the API docs for LocalTime and its siblings speak of nanoseconds; however, there's no way on earth 18.401 can mean eighteen-dot-something nanoseconds: these must be milliseconds…
page 142: reads: 'You could use the Calendar class beginning with Java 1.2' -> 1.1
page 143: nanoseconds again…
page 150, table, right column: dt.format(f); -> should be f.format(dt);

I am awfully sorry, Jeanne, if I made you waste your time on the typos that have been reported and corrected already; I don't have the 2nd edition of your book… not yet, that is
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

Not sure if these have been already corrected (at least, they are not in the errata on selikoff.net), so here are my $.02:


We aren't taking anything off the website errata list. We are considering adding a second column for "fixed in second printing"

Introduction, page xxxviii, Q17, option D, closing parenthesis is missing.


This is correct in the book. Option D is:

There are three open parens and three closing parens. One close parens is after the variable "i" and the other two are at the end.

Introduction, page xxxix, explanation to Q3, reads: 'in the parent class Cougar' -> should be Puma


I'm not seeing that in my copy. Can you include a few more words in the sentence to ensure I am looking in the right place. Also, at the very beginning of the book, there's a page with copyright, editors, etc. The last line is a bunch of numbers counting down from 10. Can you reply with those numbers say in your copy. (This will tell me which printing of the book you have in your hands.) I'm wondering if you actually have the second printing and that got broken while fixing something else.

page 95, Q6: LOC 6 and option B are inconsistent: 'Just right' vs. 'Just Right'


Good eye! Added to errata.

page 126, reads: 'which half the target it IS' -> 'which half the target is IN' ?


Correct. Added to errata.


Correct. Added to errata. And again, good eye!


Corrected. Added to errata.

page 138: 'California is three hours earlier than New York…' -> er… 'is 3 hrs BEHIND New York'?


This is an English thing. Either is correct. It is currently 2:30pm in New York and 11:30am in California. Making it earlier in California in terms of looking at a clock. It's fine for you to think of it as "behind" as long as you understand the concept. But it's not wrong.


I Just looked it up and you are right! Also, 1.1 should be 1.0 in that paragraph then!


page 150, table, right column: dt.format(f); -> should be f.format(dt);


This is correct in the book. Java has a format method on both objects so you can write it either way. This compiles:

 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

page 139: 'This time displays hours, minutes, seconds, and nanoseconds.' -> Yes, I admit that the API docs for LocalTime and its siblings speak of nanoseconds; however, there's no way on earth 18.401 can mean eighteen-dot-something nanoseconds: these must be milliseconds…


They aren't milliseconds. They are fractions of a second. It so happens in that example, that it is a number of millis. However, that's an unfortunate coincidence


This outputs: 02:06:01.000000006

Which you can see clearly is nanos.
 
Igor Soudakevitch
Author
Posts: 42
7
Android Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Looks like, we are indeed talking about different editions. My copy's metadata page contains these numbers:
ISBN: 978-1-118-95740-0
ISBN: 978-1-118-95741-7 (ebk.)
ISBN: 978-1-118-95742-4 (ebk.)
10 9 8 7 6 5 4 3 2 1
I bought an ebook then converted it from AZW to PDF. I wonder if something got corrupted during the conversion process... although it seems unlikely...

– Missing parenthesis on page xxxviii, Q17, option D:  What I see is this:


– Cougar vs. Puma on page xxxix. My copy reads: "Next, the class Cougar implements an overloaded version of getTailLength(), but since the declaration in the parent class Cougar is invalid, it needs to implement a public version of the method." And this is what page xxxi says:


– DateTimeFormatter: yes, you are right. I'm ashamed of myself
– nanos: I agree, that must be an unfortunate coincidence.

There are some other typos, too; will send them up as soon as I finish placing my own OCA Cert book on the CreateSpace platform; in a week or so.
 
Igor Soudakevitch
Author
Posts: 42
7
Android Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Admittedly, some of what follows might be related only to my copy of the book (ISBN: 978-1-118-95741-7)… Alright, this is what I've noticed:

Straighforward typos:

page 178: "subclass of bird" -> Bird
page 241: "the Java compile performs" -> "compiler"


Nitpicking:

page 287: "You’ll see that without such rules in place, it is easy to construct an example with polymorphism in Java." -> probably: "…it isn't easy to…"
page 203: "read to construct" -> no problems with the code or its output but "ready to construct" would be more appropriate semantically.
page 294: getWindSpan -> getWingSpan; same situation

~~~~~~~~~~~~~~~~~~~~~~~~~

page 254:
"At runtime the child version of an overridden method is always executed for an instance regardless of whether the method call is defined in a parent or child class method. In this manner, the parent method is never used unless an explicit call to the parent method is referenced, using the syntax ParentClassName.method()."

This wording doesn't sit with me well; reason:

Right now this syntax – ParentClassName.method() – covers only one scenario, where both parent and child methods are static, otherwise the code won't even compile.
IMHO, the call should be made via a parent object (as in new ParentClassName().method() and so on), which would cover both scenarios, that is, with static and instance methods alike.

~~~~~~~~~~~~~~~~~~~~~~~~~

page 346, explanation to Q27:
"The interface takes two int parameters. The code on line 7 attempts to use them as if one is a StringBuilder."

Here, I see two problems:

1) Interfaces do not accept params; methods do -> "The [functional] method takes…"
2) This one is major. The question is supposed to test us on lambda-related subjects but misses the target altogether. The dead giveaway is append().isEmpty(): this chain will never compile since isEmpty() is defined in String rather than StringBuilder -> whatever else the code's doing – say, is it 'lambding' properly or not – is actually irrelevant.
Replacing isEmpty() with equals("la-la-la") – because equals() is the only method in SB that returns a boolean – would be also too conspicous… (sigh)… Anyways, this LOC needs some camouflaging.
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Straighforward typos:

page 178: "subclass of bird" -> Bird


Agreed. Added to errata. It's not a big deal since it is in a comment, but yes it was intended to match the class name.

page 241: "the Java compile performs" -> "compiler"


Also added to errata.


Nitpicking:

page 287: "You’ll see that without such rules in place, it is easy to construct an example with polymorphism in Java." -> probably: "…it isn't easy to…"


Noted on our private list since the meaning is clear.

page 203: "read to construct" -> no problems with the code or its output but "ready to construct" would be more appropriate semantically.
Noted on our private list again since it isn't wrong per se, but isn't what we intended

page 294: getWindSpan -> getWingSpan; same situation


Again on private list. Thanks.


page 254:
"At runtime the child version of an overridden method is always executed for an instance regardless of whether the method call is defined in a parent or child class method. In this manner, the parent method is never used unless an explicit call to the parent method is referenced, using the syntax ParentClassName.method()."

This wording doesn't sit with me well; reason:

Right now this syntax – ParentClassName.method() – covers only one scenario, where both parent and child methods are static, otherwise the code won't even compile.
IMHO, the call should be made via a parent object (as in new ParentClassName().method() and so on), which would cover both scenarios, that is, with static and instance methods alike.


The second printing changes this to super.method(). new ParentClassName().method() wouldn't be correct. Because that would call it from outside the class and lose any state.


page 346, explanation to Q27:
"The interface takes two int parameters. The code on line 7 attempts to use them as if one is a StringBuilder."

Here, I see two problems:

1) Interfaces do not accept params; methods do -> "The [functional] method takes…"
2) This one is major. The question is supposed to test us on lambda-related subjects but misses the target altogether. The dead giveaway is append().isEmpty(): this chain will never compile since isEmpty() is defined in String rather than StringBuilder -> whatever else the code's doing – say, is it 'lambding' properly or not – is actually irrelevant.
Replacing isEmpty() with equals("la-la-la") – because equals() is the only method in SB that returns a boolean – would be also too conspicous… (sigh)… Anyways, this LOC needs some camouflaging.


This is fine. First of all, we are talking about a single abstract method interface. So it is obvious we are talking about the method in the interface. Second, we are testing knowledge of types and lambdas in conjunction. Which you saw. So you did notice part of what we were testing and it is fine.
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

Igor Soudakevitch wrote:– Missing parenthesis on page xxxviii, Q17, option D:  What I see is this:


Good find. This has in fact been wrong all along. It kept escaping me.

Igor Soudakevitch wrote:– Cougar vs. Puma on page xxxix. My copy reads: "Next, the class Cougar implements an overloaded version of getTailLength(), but since the declaration in the parent class Cougar is invalid, it needs to implement a public version of the method." And this is what page xxxi says:


Ah. This was a regression error on the second printing. That phrase was used twice so the publisher corrected both instead of just the one that was wrong.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

Jeanne Boyarsky wrote:

Page : 344, #9
Error : I am not sure about option C : shouldn't the accessor be named "getNumberWings" in order to be correct ? Is shortening really allowed ?


It is allowed. There isn't a rule that the method and variable names need to match.



I understand that it's allowed and there is no rule saying they need to match. I just want to point out that Table 4.5 "Rules for JavaBeans naming conventions" (p. 206) in the book seems to state otherwise.

The method name must have a prefix of set/get/is, followed by the first letter of the property in uppercase, followed by the rest of the property name.



Following what this says, it seems getNumWings() shouldn't be a valid choice on the Chapter Review Question, especially beings the question specifically asks about JavaBeans naming conventions.
 
Greenhorn
Posts: 10
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Chapter 3 Mock Explanation #26:
Since the type of the ArrayList isn't a int but an Integer (wrapper class) its possible to add null to it. So Answer B should be wrong!
 
Jeremy Walker
Greenhorn
Posts: 3
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

Jorma Spitz wrote:Chapter 3 Mock Explanation #26:
Since the type of the ArrayList isn't a int but an Integer (wrapper class) its possible to add null to it. So Answer B should be wrong!



I believe the issue isn't with adding null to the ArrayList. The problem is in line 9. The program would try to unbox the null to an int in the loop, as ages contains Integer objects, thus throwing the NullPointerException.
 
Jorma Spitz
Greenhorn
Posts: 10
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
You're right Jeremy. I got confused because in the explanation is written "Line 8 does not because null is not an int.". So the 'does not' referes to 'does not unbox'... I understood it as 'does not compile' because it's written right after it. But this is already in the Errata.
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

Jeremy Walker wrote:Following what this says, it seems getNumWings() shouldn't be a valid choice on the Chapter Review Question, especially beings the question specifically asks about JavaBeans naming conventions.



Except that the table is wrong. From page 206 of the errata

Table 4.5 is incorrect. It is legal (but less common) for a boolean getter to begin with get rather than is. This means that line 14 is just fine as a boolean getter.

 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

Jorma Spitz wrote:You're right Jeremy. I got confused because in the explanation is written "Line 8 does not because null is not an int.". So the 'does not' referes to 'does not unbox'... I understood it as 'does not compile' because it's written right after it. But this is already in the Errata.


Correct. Thanks for pointing this out.

All: Feel free to start a new thread when you spot something. Everything about the book doesn't have to live in this thread .
 
Jeremy Walker
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

Jeanne Boyarsky wrote:
Except that the table is wrong. From page 206 of the errata

Table 4.5 is incorrect. It is legal (but less common) for a boolean getter to begin with get rather than is. This means that line 14 is just fine as a boolean getter.



Except that the errata does not refer to using a partial name (i.e. getNumWings() vs. getNumberWings()), at least that I see. It only references the boolean get/is issue. Also, I believe the book I quoted from is the copy with most of the errata fixed, including the one you referenced.
 
Greenhorn
Posts: 24
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Page XLII
Assessment Test Explanation, Question 20

Option F is a throwable and not an exception, and so should not be caught
or declared.


Actually Throwable instances (except Error and RuntimeException subclasses) are checked, so it should be:
Option F is an Error and so should not be caught or declared.
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

Guram Savinov wrote:Actually Throwable instances (except Error and RuntimeException subclasses) are checked, so it should be:
Option F is an Error and so should not be caught or declared.


Error extends Throwable. Throwables (except for Exceptions) shouldn't be caught so from the point of view of the exam, this is still correct.
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
I'm closing this thread as it is starting to look like the official place to report all errors. It's hard for me to manage what I've read in a giant thread. Please create a new thread in this (the OCA forum). Just mention "Sybex" in the title to ensure I see it. You might mention a page number or chapter number in the subject too.

If you have multiple things to report at once, it's fine to put them in one thread. It's just the "one thread of everything that goes on for months" that I'm struggling with.
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic