Forums Register Login
Sybex OCA OCP Practice Test - Errata
Page 457 - explanation#36:

Finally, the declaration of thursday does not compile because the final modifier cannot appear before the access modifier.

Above declaration of thursday compiles without any problem.
The correct answer should therefore be: B instead of C
Page 309 - question#21:

It should be:  ... new File("C:/students.data") or new File("C:\\students.data")
Page 548 - explanation#22:

5: Locale.setDefault(new Locale("en", "AU"));
The three lines printed by the code are ko, en_US and en.

It should be: ... ko, en_AU and en.
Chapter 19 page 329 question 28:

The correct answer is D and not C as described on page 532.

When I add a main method there and try it:

...  then it really converts relative path to absolute:
Chapter 23 page 407 question #44:

There should be Given an updatable and scrollable ResultSet  ... instead of Given an updatable ResultSet ... when correct answer is A.

Because result set is forward only as default and then afterLast() and previous() methods will throw SQLException and correct answer would be D.
As with your other post, sorry it took me so long to get to this. I knew I had to allocation a bunch of time and never got to it. And this book is newer so less people have reported errata. Making any comments more likely to be correct.

Juerg Bauman wrote:Chapter 11 - question 23: (page 197/489)

Option A is allowed because the turnOn() method is public and can be called from anywhere.

This is not correct. The class com.light.Flashlight has no access modifier (=package-protected) and is therefore not visible by any class in package com.dark.
The correct answers should be: A and C

That is an excellent point. I've added to assume the classes are public to the question in the errata. (Granted we should have put that in the diagram, but diagrams won't get fixed if there is a second printing so text errata are more practical)

Juerg Bauman wrote:Page 492 - explanation 14:
typing error --> For these reasons ...

Agreed. Added to errata.

Juerg Bauman wrote:Page 492 - explanation 15:
The constructor for an enum type must be package-private or private access.

True. The exam doesn't cover package private ones. We shouldn't have said that in the explanation though. So I made the errata replacement text "enum constructors must not be protected""

Juerg Bauman wrote:Page 505 - explanation #31:
It should be: ... It uses the method applyAsDouble().

Agreed. Added to errata.

Juerg Bauman wrote:Page 549, explanation #30:
The incorrect code is on line 9.

Agreed. Added to errata.

Juerg Bauman wrote:Page 537 - explanation 15:
There is another error, since f.get() throws checked exceptions, which have to be caught or declared.
This doesn't affect the correct answer, which remains B.

Sorry. It's our old friend "the exam assumes excepts are caught/declared when the code shown is not in a method".

Juerg Bauman wrote:Page 538, explanation #21:
Just a typo...

Agreed. Added to errata.

Juerg Bauman wrote:Page 538, explanation #23:
The variable count is a primitive of type int and several threads are updating it. To avoid race condition it should be declared as AtomicInteger instead of int?

If the code worked, you would be right. Instead it is an evil trick . This code does not actually share the object/variable. So it is thread safe. Wrong as the variable is useless. But thread safe. And intentionally wrong to trick readers.

Juerg Bauman wrote:Page 540 - explanation #33:
It's the opposite: If offer() had been used instead of push() ...

Agreed. Added to errata.

Juerg Bauman wrote:Page 302 - question#4:
I'm not english native, but something is wrong with that sentence.

It may not be grammatically perfect, but people to speak that way (sloppily). So it isn't a typo. We intended to write that. (It obviously could have been clearer to non-native speakers). It could be re-worded as "Suppose a class implements java.io.Serializable. Which methods is that class required to implement"

Juerg Bauman wrote:Page 304 - question#10:
Typo: For a given file, the absolute path is the path ..

Juerg Bauman wrote:
Post 2/7/2018 6:12:56 AM     Subject: Sybex OCA OCP Practice Test - Errata
Page 196 - question#21 (singleton pattern):
It's just a doubt, probably not an error.

Good point. Will make a note on our private list of things that could be clearer but not actually an errata.

[submitting post lest anything happen to my computer. then continuing to reply]

Juerg Bauman wrote:Page 494 - explanation #29:
Option C is not working even for static nested classes. The correct syntax would be: new Dinosaur.Pterodactyl() or just new Pterodactyl()

Right. We meant that's why someone might think Option C would work. Not that it does.

Juerg Bauman wrote:Page 504 - explanation #22:
It should be reverse: ... is used for Consumer, not Supplier, ...

Agreed. Added to errata

Juerg Bauman wrote:On page 345 - question #19: not an error, just a suggestion
I was surprised that this line actually did compile, because execute() takes a Runnable with return type void. The method getAnswer() has return type String.
The explanation: https://coderanch.com/t/690723/java/ExecutorService-execute-Runnable
Possibly I didn't get that fact earlier, maybe you could add it to your explanation.

Yeah. Weird isn't it. Good point about adding it.

Juerg Bauman wrote:Page 523 - explanation#15:
OutputStream uses byte[], while Writer uses char[].

Agreed. Added to errata

Juerg Bauman wrote:Page 361 - question#18:
It should be: select from books ...

Agreed. Added to errata

Juerg Bauman wrote:Page 542 - explanation#2:
just a typo

Agreed. Added to errata

Juerg Bauman wrote:Page 410 and 558 - question#49:
The method compareTo() belongs to Comparable which is implemented on the class being compared.
There can be only one implementation, which should follow the contract: compareTo should return 0 if equals returns true.
So answer E should be true, but not always will...
By the way is " ... multiple comparators" meant with Uppercase Comparators?

While you are correct, this is a "choose two" question. C and D are always correct. Which trumps not always correct. We gave a counter example for the case where it is not always correct

Juerg Bauman wrote:Page 561 - explanation#67:
there is a fourth error on line 12, since Function apply() takes just one argument, not two.
The answer remains correct: E

If line 7 was fixed (Function was changed to BiFunction) the compiler error you mention does not exist.

Juerg Bauman wrote:Page 562 - explanation#80:
It should be: ... does not is checked and must ...

Agreed. Added to errata

Juerg Bauman wrote:Page 496 - explanation#2:
There is no such method available in List, there is one called replaceAll().

Agreed. Added to errata

Juerg Bauman wrote:Page 452 - explanation#4:
The result is a compiler error, not an exception at runtime.

Agreed. Added to errata
Wink, wink, nudge, nudge, say no more ... https://richsoil.com/cards

This thread has been viewed 1612 times.

All times above are in ranch (not your local) time.
The current ranch time is
Sep 20, 2018 00:28:01.