This week's book giveaway is in the Server-Side JavaScript and NodeJS forum.
We're giving away four copies of Modern JavaScript for the Impatient and have Cay Horstmann on-line!
See this thread for details.
Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!

J Deckarm

Ranch Hand
+ Follow
since Jan 11, 2015
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by J Deckarm

I just noticed this; there seems to have been some problems with my email address and coderanch was not able to mail to me about this issue. I have now changed the address but apparently I missed the deadline to register for the prize in the meantime
Thanks for the consideration anyway; and if there would be any option to still get it, just let me know. I just passed OCPJP7 this week so upgrade to OCPJP8 could be a next step

Passed today with 91%
Preparation material: K+B OCP7 book, Ganesh-Sharma OCP7 book (tests only), enthuware OCP7 tests, K+B SCJP6 practice tests book
Preparation lasted over several months, I started already back in 2014 summer but then significant periods of time were completely skipped due to heavier workload or other priorities. I had a company voucher that expires at the end of October so it had to be completed by now. Eventually I spent the last 14 weeks with processing one topic per week in detail based on my earlier prepared notes/coding (hereby sending my greetings to Roel de Nijs for reviewing all my errata posts), and then the last two weeks with one topic per day final checking

The exam was not particularly hard, e.g. generic and threads were a piece of cake compared to some of the more complex practice questions, but there were surprisingly high number of questions that contained topics that were explicitly noted as not being part of the exam (e.g. io streams, matcher replacing, rowset property setters) or contained API that I did not remember ever to be appearing neither in the K+B book nor in the ~1200 practice questions I went through
4 years ago
chapter 4, page 255
question 7 is related to enums, OCP objective 2.5, which is not listed beside the answer (it is mentioned at the question itself on page 252)
chapter 7, page 395, table 7-3
"Java 7 with duplication" row "What happens if rain() adds a new checked exception?" case says to "Add another exception to the multi-catch block to handle the new exception."
This seems to be incomplete, as in this case it seems that the newly added exception also has to be added to the throws clause of the ahhh() method. Or alternatively, it also seem to compile, if the newly added exception is not added to the multicatch, only to the throws clause of the ahhh() method.
Also "Java 6 style" seems to be incomplete, assuming the catch block for the newly added exception also contains a rethrow, i.e. catch (C e) { throw e; }, then C has to be also added to the throws clause of the ahhh() method
In general, the entire table seems to would worth reviewing and all possible cases described
CD mock exams, objective 3, OCP Exam 1, question 4
answer B is marked as correct: "HAS-A relationships always rely on instance variables"
CD mock exams, objective 3, OCP Exam 2, question 3
answer E is marked as incorrect: "HAS-A relationships are always defined with instance variables", and explanation says "class variables (statics) can also be used to define HAS-A relationships"
CD mock exams, objective 3, OCP Exam 1, question 3
Answer C states: "IS-A relationships always require at least two class types"
=> Since as much as I am aware IS-A also applies to interfaces and not classes only, I think that should be somehow also part of the statement. At least on first interpret, I thought this answer is not correct, because of interfaces not mentioned. Later I figured the intention might have been to focus on "at least two" (i.e. one is not enough), but I still consider it capable of misinterpretation
CD mock exams, objective 3, OCP Exam 1, question 2
Answer D, "Woop has-a Hmpf and Woop has-a Zing" is not marked correct
- Woop has-a Hmpf: Woop is-a Zing and Zing has-a Hmpf, so this one should be true
- Woop has-a Zing: Woop is-a Zing, Zing has-a Hmpf and Hmpf has-a Zing, so this one should be also true

As much as I am aware, has-a is transitive, i.e. when A has-a B and B has-a C, then A has-a C
I have now checked and there has been already a debate about this on coderanch almost a decade ago
where the conclusion seemed to be not transitive
but see also e.g. K&B OCP JAVA 6 (310-065) Practice Exams book from 2010, practice exam I, question 54, where the correct answers assume has-a being transitive ("Jookers have Strings indirectly through Bostrons")

(This post originated in the K&B7 errata thread)
chapter 10, page 571, answer 5
"Not shown is a class implementing class G that actually creates the object."
=> Should be likely "extending class G"

Roel De Nijs wrote:

J Deckarm wrote:chapter 15, page 907
"Unlike prepared statements, stored procedures and functions must exist before a CallableStatement can be executed on them."
=> This sentence seems to be somewhat confusing; sounds as if CallableStatement would execute PreparedStatement as well

Thanks for the suggestion! But the previous sentence clearly states that a CallableStatement is used to execute a named stored procedure or function. So I think it's pretty obvious a prepared statement can't be executed using a CallableStatement.

While I see your point, I still find the sentence confusing; what does then "unlike prepared statements" mean in this context?

(This post originated in the K&B7 errata thread)
CD mock exams, objective 1, OCP Exam 1, question 2
While the explanation seems to be a valid statement, the compilation seems to fail on the first place because of super cannot be used in a static context; regardless whether the method in the parent class is static or non-static
I agree. However, given that there are apparently more than one similar issues, maybe a general remark would worth mentioning in this chapter, that not all versions of every vendor's JDBC implementation seems to be fully compliant with the contract.
I did use a scrollable RS (TYPE_SCROLL_INSENSITIVE), actually I noticed this when playing with the RS navigation methods in the book with various arguments, and all seemed to work as described, except from absolute(0)

Per your suggestion regarding another of my questions ( I have checked this one as well with OJDBC 12, and there it seems to work correctly. Perhaps this is also something that has been made compliant in a later release only.
chapter 12, self-test q6
explanation says: "The variable referenced by f is an instance of an anonymous subclass of Bar..."
=> Should be rather likely "The object referenced by the variable f..." (just as two sentences earlier regarding variable t)
Thank you, indeed I use JDK8. I now checked with JDK7, and experienced the same as you did. I agree with your conclusion too.
CD mock exams, objective 6, OCP Exam 1, question 6
Answer E states "Never throw an AssertionError explicitly" is not marked as a correct answer, yet in the explanation it states "throwing an AssertionError explicitly is considered bad practice"