Either way, glad to see people reading the study tips section, we weren't sure if people were enjoying them!
Fun fact that got dropped from that appendix. The last time I took a certification the power went out for 5 minutes! The test administrator assured me my progress was safe, and it was!
I've just started reading the book and the study tips section as advised, and although I do have some strong experience with Java and programming language in general, I find this section has some useful tips which I'm sure will come in handy when I take the exam (+1 for the loss of power !)
Thanks for writing this book, it will definitely help me increasing a lot my java knowledge and get the OCP
I've taken the OCP exam about a couple of weeks ago and passed it with a score of 90+ so I'm quite happy about my result. Thank you for your book as well as the online material, all this has been instrumental to my success.
I may have found additional typos/errors(I'll let you be the judge of that), I've compiled my findings into the table below. There should not be any duplicates with what's currently in the errata. If you have any questions about these please let met know. Also note that I have used JDK 1.8.0_74.
Cheers and thanks again!
|130||Table 3.4||"void add (E element)" should be "boolean add (E element)"|
|157||Last sentence||In a nutshell computeIfPresent() calls the BiFunction if the requested key is found". This is true only if the associated key is not null. I suggest you add "… and the associated key is not null" to this sentence|
|159||Table 3.12||The "computeIfAbsent" column for row "null value in map" and "Not null" should say "Set key to mapping function result" rather than "Add key to map with mapping function result as value" because the key already exists in the map (although it has a null value associated)|
|160||Last sentence of 2nd paragraph||The compiler does not raise any error when attempting to remove an item from an unbounded or upper-bounded wildcard list. This actually compiles and runs fine|
|218||2nd sentence||"rather than the Collector class" should be "rather than the Collector interface"|
|265||Table 5.8||For matching resource bundle "Zoo_fr_FR.java", files keys can also come from Zoo_fr.properties and Zoo.properties (if Zoo_fr.java and Zoo.java are not present). For matching resource bundle "Zoo_fr.properties", keys can also come from Zoo.java (Zoo.java will be chosen in priority over Zoo.priorities if both are present)|
|315||1st paragraph||DateTimeParseException is not a checked exception in contrary to IOException and SQLException|
|340||Table 7.3||In the description of the second row, "completely" should be replaced by "completed"|
|352||First sentence||In "results from earlier threads are output before ones that started later", "before" should be replaced by "after"|
|408||3rd sentence||In "Alternatively, the relative path … from the current working directory to file or directory", "to file or directory" should read "to a file or directory"|
|425||Last sentence of 3rd paragraph||"we have access to the all of the methods" should read "we have access to all of the methods"|
|467||relativize() section||I find that the example for relativize() is confusing when used with files because the relative path from fish.txt to birds.txt should be "./birds.txt" instead of "../birds.txt". According to Java documentation, relativize does the contrary of resolve and resolve considers by default that the path on which it is called is a directory. So presumably, Java makes the same assumption for relativize(), i.e. it considers by default that the path on which it is called is a directory, which explains the ..|
|475||3rd sentence of "Removing a File with delete and deleteIfExists" section||In "…, the operation will throw the runtime DirectoryNotEmptyException", "runtime" is not correct as this exception is a checked exception. You may want to remove "the runtime" and maybe add "at runtime" after "DirectoryNotEmptyException" ?|
|478||Last sentence of 4th paragraph||In "For example, some operating systems may not have a notion of user-level permissions, …", "may not" should be replaced by "may"|
|525||In the 2nd sample showing how to retrieve the number of rows of the animal table||rs.getInt("count") throws an exception because the "count" column is unknown (it is known as "1" instead)|
|527||Table 10.6||getTimeStamp() and java.sql.TimeStamp should respectively read getTimestamp() and java.sql.Timestamp|
|531||Last sentence||This sentence is confusing, it seems like relative() may return something else than a boolean if the cursor is not pointing to a row with data. This sentence should rather mention that relative() returns false if the cursor is not pointing to a row with data|
|562||Answer to question 3||Line w4 does not handle the InterruptedException and ExecutionException that may be thrown by calling result.get() so I would argue that E would be a correct answer. (line w4 would need to be wrapped in a try catch statement)|
|566||Answer to question 12||Answer D is also valid. A File object is correctly created on a Windows OS when using // instead of /. Calling the exists() method on this file object does return true if the file exists which proves that it works fine. Although this is a valid answer I think it brings confusion as, as I understand it, it is not something we should consider as a good practive to create a File object.|
|Mock exam 2||Question "What changes need to be made to make the following singleton pattern correct||The exhibitionManager variable should be private instead of public in the code sample (otherwise encapsulation of the singleton variable is not correctly implemented). Alternatively there should be an addition answer in the lines of "Change the access modifier of the exhibitionManager variable from public to private|
Congrats on your pass and your great score!
130 - Yes. This one was already reported. I'd rather have something reported twice rather than never though so no worries!
157, 159 - Agreed and added. (This section was added the last minute when Oracle added material to the upgrade exam so it was a bit rushed. That's why that table has so many issues)
160 - You're right. Only adding is a problem. Noted. (don't want to overload 'added' by saying added!)
218 - Agreed and added
265 - Agreed and added. That table is wrong. I was thinking about how Zoo_en.java is not included. However, you are correct that the property files are
315 - Yes. This one was already reported. It says "various" for the page number for chapter 6 because this is consistently wrong.
340 - Agreed and added
352 - Agreed and added. As written it is a really complicated way of saying "in order"!
408 - Added. I added it as "to the file" rather than "to a file" for consistency with the rest of the paragraph
425 - Agreed and added
467 - I put this in our private list since confusing != wrong
475 - Agreed. It should just say throw. Readers know that exceptions are thrown at runtime by chapter 9.
478 - No. I think this sentence is accurate both ways. To be really explicit it could say "may or may not" but that feels redundant.
525 - Agreed this is wrong. I prefer the fix "select count(*) as count because readers don't need to know SQL for the exam so they don't need to know what the default column name is.
527 - Agreed
531 - I made a note to consider this for a future version of the book. However, I think it is clear. There are only two possible values for a boolean - true and false. If it doesn't return true, it has to return to false.
562 - No. If code is not in a method, you have to assume that relevant exceptions are handled/thrown. This is true on the exam as well so it is important. Oracle even made this explicit recently with this text on each exam objectives page:
Assume the following:
Missing package and import statements: If sample code do not include package or import statements, and the question does not explicitly refer to these missing statements, then assume that all sample code is in the same package, and import statements exist to support them.
No file or directory path names for classes: If a question does not state the file names or directory locations of classes, then assume one of the following, whichever will enable the code to compile and run:
All classes are in one file
Each class is contained in a separate file, and all files are in one directory
Unintended line breaks: Sample code might have unintended line breaks. If you see a line of code that looks like it has wrapped, and this creates a situation where the wrapping is significant (for example, a quoted String literal has wrapped), assume that the wrapping is an extension of the same line, and the line does not contain a hard carriage return that would cause a compilation failure.
Code fragments: A code fragment is a small section of source code that is presented without its context. Assume that all necessary supporting code exists is present and that the supporting environment fully supports the correct compilation and execution of the code shown and its omitted environment.
Descriptive comments: Take descriptive comments, such as "setter and getters go here," at face value. Assume that correct code exists, compiles, and runs successfully to create the described effect.
566 - Choice D works on Mac too! Definitely a correct answer although it isn't on the exam.
Mock exam question - I agree it should be a private variable. Not sure why an additional answer choice would be needed though.
157 Last sentence
In a nutshell computeIfPresent() calls the BiFunction if the requested key is found". This is true only if the associated key is not null. I suggest you add "… and the associated key is not null" to this sentence
It should be: ... This is true only if the associated value is not null. I suggest you add "… and the associated value is not null"