The proper extension for a Java compiled bytecode file is .java
[OCP 21 book] | [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
C. You can convert a wrapper class object to a primitive by calling valueOf().
... because this method is used for converting to a wrapper class from a String ...
A. Assuming the variables are not primitives ...
Options A and B are static methods rather ...
Juerg Bauman wrote:Chapter 2 - question 27: (page 24 and 435)
Answer B is correct.
But the explanation to the incorrect answer C is strange:
C. You can convert a wrapper class object to a primitive by calling valueOf().
... because this method is used for converting to a wrapper class from a String ...
There is an overloaded Integer.valueOf( int i) which converts primitive to wrapper.
Therefore answer C is wrong because it converts primitive to wrapper, and not vice versa wrapper to primitive.
[OCP 21 book] | [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
Juerg Bauman wrote:Chapter 2 - question 32: (page 25 and 435)
The explanation states:
A. Assuming the variables are not primitives ...
A String instance variable (variable containing a reference to a String object?) is never primitive, wrigth?
[OCP 21 book] | [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
Juerg Bauman wrote:Chapter 2 - explanation to question 47: (page 436)
Options A and B are static methods rather ...
A and B are incorrect method declarations, since the position of "static" between return type and method-name is wrong.
[OCP 21 book] | [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
The outer loop decrements i i, making it 0.
The class contains two constructors and one method.
[OCP 21 book] | [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
Predicate is an interface with one method.
Juerg Bauman wrote:Chapter 9 - question 22: (page 141)
a reference variable s is used without declaring its type. This question cannot be answered like that, one needs to know that s is of type String.
Juerg Bauman wrote:On page 475 - explanation 36:
Predicate is an interface with one method.
It should say: ... interface with one abstract method.
[OCP 21 book] | [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
Juerg Bauman wrote:On page 9, question 22:
The explanation declares above line 3 as valid definition for a method, and therefore as correct answer.
This is incorrect since the terminal semicolon is missing.
[OCP 21 book] | [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
Option A is allowed because the turnOn() method is public and can be called from anywhere.
For these reason, Options A, C ...
Finally, enum constructors must be private, meaning ...
B. The ToDoubleFunction interface takes a generic value, not a double value, making
Option D incorrect. It also uses the method name accept().
Line 10 is incorrect.
If the code was fixed to use the correct method name, then it would complete without issue, ...
The result is it may output 0, 1000, or anything in-between ...
If count was marked static, then the application would sum the elements correctly, ...
If push() had been used instead of offer() in the third loop, with new values being inserted at
the tail of the queue instead of at the head, ...
Which methods are classes that implement java.io.Serializable required to implement?
For a given file, the absolute is the path from ...
... while the relative path is the path from ...
C. Dinosaur.new Pterodactyl();
...
Option C is incorrect. Pterodactyl is a member inner class, not a static nested class.
The method reference is used for Supplier, not Consumer, since it takes a value and does not return anything.
Finally, because both can be used with a byte array, Option D is incorrect.
Given the table books in the figure...
...
select * from cert where title = 'OCA'
... so the creators of the exam iare free to ...
E. Two objects that return true for equals() will always return 0 when passed to compareTo().
...
Option E is incorrect because multiple comparators can use different orders for comparison, which do
not need to match the definition of equality.
while any class that does not is unchecked and must be declared or handled.
Option C is incorrect because the replace() method is available on List, ...
... and trying to output a void return type in the print() method throws an exception at runtime.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |