This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of Darcy DeClute's Scrum Master Certification Guide: The Definitive Resource for Passing the CSM and PSM Exams and have Darcy DeClute on-line!
See this thread for details.
  • Post Reply 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
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

Errata for OCP: Oracle Certified Professional Java SE 8 Programmer II Study Guide - Online Material

 
Ranch Hand
Posts: 241
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the Bonus Exam 3, the question with Fish, Trout, Fins and Gills has a typo in one of the options:

F. Trout has-a gills.



should be

F. Trout has-a Gills.



As is, the statement refers to the instance variable gills and can't really be said to be correct. Since this answer is marked as correct, it needs to refer to the type Gills.
 
T Vergilio
Ranch Hand
Posts: 241
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bonus Exam 3, the question with the code below:



has option D as the correct answer.

D. The code throws CustomException and CustomException as suppressed exceptions.



I believe it should be option E:

E. The code throws CustomException and also a CustomException as a suppressed exception.



There is only one suppressed exception.

 
T Vergilio
Ranch Hand
Posts: 241
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The question with the code:


has the wrong answered marked as correct.
The explanation is right though:

First, we need to know what path2 resolves to. The value path1.subpath(1, 4) returns habitat/./party.txt, which we join to the current directory /home with the toAbsolutePath() method in order to see that we are accessing the file /home/habitat/party.txt, so B is correct and A and C are incorrect.



These are the options:

B. It will access the file /habitat/party.txt.


C. It will access the file /home/habitat/party.txt.



C is correct, not B.
 
author & internet detective
Posts: 41775
887
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks. I agree with all three.

For your second post, what we submitted and what wound up on the site are quite different:
In the CustomException example, Choice D should be worded as "The code throws CustomException and also CustomException as a suppressed exceptions." Choice E should be worded as "The code throws CustomException and two instances of CustomException as a suppressed exceptions."

So D was right with the original wording!
 
T Vergilio
Ranch Hand
Posts: 241
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That makes sense, I did think the two options were a bit too similar to have been intentional. Thanks for checking!
 
T Vergilio
Ranch Hand
Posts: 241
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Card #2 from the second set of flashcards should say the only access modifier for an enum's constructor is private. When none is declared, it defaults to private (not default):

In an enum declaration, a constructor declaration with no access modifiers is private.


source: http://docs.oracle.com/javase/specs/jls/se8/html/jls-8.html#jls-8.9.3
 
T Vergilio
Ranch Hand
Posts: 241
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The answer for card #45 of the first deck should be:

Bearing in mind that, if it finds a .java file, it doesn't use the corresponding .properties file.
 
T Vergilio
Ranch Hand
Posts: 241
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Card #22 of third deck: there is also replaceAll(), which takes a UnaryOperator.
 
T Vergilio
Ranch Hand
Posts: 241
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Card #23 of third deck: forEach takes a Consumer in Iterable, but it takes a BiConsumer in Map.
 
Jeanne Boyarsky
author & internet detective
Posts: 41775
887
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

T Vergilio wrote:Card #2 from the second set of flashcards should say the only access modifier for an enum's constructor is private.


This was already fixed and I see the correct version. Caching error maybe?

T Vergilio wrote:The answer for card #45 of the first deck should be:


I disagree. The question on that flashcard states that a .properties file was found. So it would be looking for other property files, no?

T Vergilio wrote:Card #22 of third deck: there is also replaceAll(), which takes a UnaryOperator.


Agreed and added to errata. replaceAll() wasn't in the initial exam objectives. We added it to the chapter right before the book went to press and didn't realize there was a question in the flashcards on the topic.

T Vergilio wrote:Card #23 of third deck: forEach takes a Consumer in Iterable, but it takes a BiConsumer in Map.


Agreed and added. forEach for Map was also a late edition to the book. Pretend the flashcard asks about ArrayList for now. I'll try to get these two fixed online.
 
T Vergilio
Ranch Hand
Posts: 241
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jeanne Boyarsky wrote:This was already fixed and I see the correct version. Caching error maybe?


I think it was changed the other way around. There's a note in the Errata referring to this flashcard saying an enum's constructor can be private or default. It can only be private. When you don't specify an access modifier, it defaults to private.

Jeanne Boyarsky wrote:I disagree. The question on that flashcard states that a .properties file was found. So it would be looking for other property files, no?


Even when the matching file is a .properties file, getBundle() still works its way up instantiating that file's parent chain, giving preference to .class files. Look at the examples from the ResourceBundle API, note how they mix the two types:

Example:

The following class and property files are provided:

MyResources.class
MyResources.properties
MyResources_fr.properties
MyResources_fr_CH.class
MyResources_fr_CH.properties
MyResources_en.properties
MyResources_es_ES.class

The contents of all files are valid (that is, public non-abstract subclasses of ResourceBundle for the ".class" files, syntactically correct ".properties" files). The default locale is Locale("en", "GB").
Calling getBundle with the locale arguments below will instantiate resource bundles as follows:

Locale("fr", "CH") MyResources_fr_CH.class, parent MyResources_fr.properties, parent MyResources.class
Locale("fr", "FR") MyResources_fr.properties, parent MyResources.class
Locale("de", "DE") MyResources_en.properties, parent MyResources.class
Locale("en", "US") MyResources_en.properties, parent MyResources.class
Locale("es", "ES") MyResources_es_ES.class, parent MyResources.class

The file MyResources_fr_CH.properties is never used because it is hidden by the MyResources_fr_CH.class. Likewise, MyResources.properties is also hidden by MyResources.class.


Source: https://docs.oracle.com/javase/8/docs/api/java/util/ResourceBundle.html#getBundle-java.lang.String-java.util.Locale-java.lang.ClassLoader-
 
T Vergilio
Ranch Hand
Posts: 241
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jeanne Boyarsky wrote:

T Vergilio wrote:Card #22 of third deck: there is also replaceAll(), which takes a UnaryOperator.


Agreed and added to errata. replaceAll() wasn't in the initial exam objectives. We added it to the chapter right before the book went to press and didn't realize there was a question in the flashcards on the topic.


I just remembered there's also sort(), which takes a Comparator. This is an easy one to miss because Comparator has been around for ages, but it is a functional interface now, and the sort() method is a Java 8 addition to List.
 
Jeanne Boyarsky
author & internet detective
Posts: 41775
887
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

T Vergilio wrote:I think it was changed the other way around. There's a note in the Errata referring to this flashcard saying an enum's constructor can be private or default. It can only be private. When you don't specify an access modifier, it defaults to private.


I stand by the answer. The code does compile if you don't specify an access modifier. The answer isn't about the effective access modifier. It is about what you are allowed to type.

T Vergilio wrote:
Even when the matching file is a .properties file, getBundle() still works its way up instantiating that file's parent chain, giving preference to .class files. Look at the examples from the ResourceBundle API, note how they mix the two


Ok. I added an errata saying it should say "property files". That makes the answer correct and matches the intent.

T Vergilio wrote:
I just remembered there's also sort(), which takes a Comparator.



While that is true, it's not covered in the section at the end of the chapter that talks about the methods in the question. The intent is for the flashcard to match that part of the chapter.
 
T Vergilio
Ranch Hand
Posts: 241
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jeanne Boyarsky wrote:
I stand by the answer. The code does compile if you don't specify an access modifier. The answer isn't about the effective access modifier. It is about what you are allowed to type.


I suppose, even when it comes to access modifiers for classes and members, the Java documentation doesn't use the word default to refer to what we know as "default access". They call it package private or package access.

A class or interface type declared without an access modifier implicitly has package access.


A class member or constructor declared without an access modifier implicitly has package access.


Source: http://docs.oracle.com/javase/specs/jls/se8/html/jls-6.html#jls-6.6.1

Indeed, from this perspective, "default access" is allowed in both. In one case, it defaults to one thing and, in the other case, to something else. I'm happy to settle for that
 
If you open the box, you will find Heisenberg strangling Shrodenger's cat. And waving this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic