|
![]() |
F. Trout has-a gills.
F. Trout has-a Gills.
OCA Java 6, OCP Java 6, OCP Java 8
D. The code throws CustomException and CustomException as suppressed exceptions.
E. The code throws CustomException and also a CustomException as a suppressed exception.
OCA Java 6, OCP Java 6, OCP Java 8
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.
B. It will access the file /habitat/party.txt.
C. It will access the file /home/habitat/party.txt.
OCA Java 6, OCP Java 6, OCP Java 8
[OCP 17 book] | [OCP 11 book] | [OCA 8 book] [OCP 8 book] [Practice tests book] [Blog] [JavaRanch FAQ] [How To Ask Questions] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
OCA Java 6, OCP Java 6, OCP Java 8
In an enum declaration, a constructor declaration with no access modifiers is private.
OCA Java 6, OCP Java 6, OCP Java 8
OCA Java 6, OCP Java 6, OCP Java 8
OCA Java 6, OCP Java 6, OCP Java 8
OCA Java 6, OCP Java 6, OCP Java 8
T Vergilio wrote:Card #2 from the second set of flashcards should say the only access modifier for an enum's constructor is private.
T Vergilio wrote:The answer for card #45 of the first deck should be:
T Vergilio wrote:Card #22 of third deck: there is also replaceAll(), which takes a UnaryOperator.
T Vergilio wrote:Card #23 of third deck: forEach takes a Consumer in Iterable, but it takes a BiConsumer in Map.
[OCP 17 book] | [OCP 11 book] | [OCA 8 book] [OCP 8 book] [Practice tests book] [Blog] [JavaRanch FAQ] [How To Ask Questions] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Jeanne Boyarsky wrote:This was already fixed and I see the correct version. Caching error maybe?
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?
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.
OCA Java 6, OCP Java 6, OCP Java 8
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.
OCA Java 6, OCP Java 6, OCP Java 8
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.
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
T Vergilio wrote:
I just remembered there's also sort(), which takes a Comparator.
[OCP 17 book] | [OCP 11 book] | [OCA 8 book] [OCP 8 book] [Practice tests book] [Blog] [JavaRanch FAQ] [How To Ask Questions] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
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.
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.
OCA Java 6, OCP Java 6, OCP Java 8
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
|