I started studying for the Java 11 OCP exam (part I) and I was going through the review questions for chapter 1. I came across question 14 (chapter 1, page 32), which sounds like this:
Which options are valid on the jar command without considering module options? (Choose all that apply.)
The answer to the question states the following:
A, B, C, E. When creating a jar file, you use the options -cf or -cvf, making options A and E correct. The jar command allows the use of the classpath, making option C correct. It also allows the specification of a directory using -C, making option B correct. Options D and F are incorrect because -d and -p are used for modules.
I am a bit confused by the part in bold, because I did not remember seeing the classpath option as valid for jar. I've also checked the official documentation for jar and I did not find any reference to -cp (I think java -cp could be valid if -c stands for create and p for the module path, if I am not mistaken).
This looks like an error in the study guide, which means only A, B and E are correct. If this isn't the case, can someone please explain?
L.E. I've just seen it in the official errata, but it was at the bottom of the list. This is indeed an error.
I'm sorry. I am new so I wasn't sure how you guys do things here.
So, to get back to the topic:
I found another issue in chapter 2 page 51, in the paragraph right above the note.
The code snippet shown as example looks like this:
Then, the explanation states the following:
The answer variable is initialized in both branches of the if statement, so the compiler is perfectly happy. It knows that regardless of whether check is true or false, the value answer will be set to something before it is used. The otherAnswer variable is initialized but never used, but the compiler is equally as happy. Remember, the compiler is only concerned if you try to use uninitialized local variables; it doesn’t mind the ones you never use.
I've highlighted the faulty part. As I see it, the otherAnswer variable is not initialized, it is only declared.
In addition to the standalone 815 and 816 study guides, our publisher is going to be printing a combined one. Which means we get to fix such errata in that! Thanks for contributing one, (And I've credited you on the errata page)