2. E. The code will not compile because the parent class Mammal doesn’t define a no-argument constructor, so the first line of a Platypus constructor should be an explicit call to super(int age). If there was such a call, then the output would be MammalPlatypus, since the super constructor is executed before the child constructor.
C. Both can be extended using the extend keyword.
“Both abstract classes and interfaces can be extended with the extends keyword, so option C is correct”.
B. A class that implements HasVocalCords must override the makeSound() method.
C. A class that implements CanBark inherits both the makeSound() and bark() methods.
“Option B is incorrect, since an abstract class could implement HasVocalCords without the need to override the makeSound() method”.
Mushfiq Mammadov wrote:On page 291, review question #2, line should be “7” instead of “8”
Mushfiq Mammadov wrote:The output would be MammalPlatypus if call new Platypus(); instead of new Mammal(5); .
Mushfiq Mammadov wrote:Maybe authors intend to write extends in option C.
Mushfiq Mammadov wrote:“{” is missing in first line
Mushfiq Mammadov wrote:4. On page 295, review question #14:
I guess that the answer of this question is incorrect
Maybe authors intend to write “An abstract class” instead of “A class” in option B.
Mushfiq Mammadov wrote:5. On page 347, mock explanation #3:
In fourth sentence CanHope interface should be CanHop.
[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 think this one is correct in the book. An abstract class is a type of class. Which means it is possible for a class to implement the interface without implementing that method. The "trick" in the question is to see if you recognize that situation. Giving away in the answer that we are thinking about abstract classes makes it to easy.
The question doesn't say "any class", it says "a class". Which means "there exists a class that makes this statement true."
Mushfiq Mammadov wrote:. After your reply I understand that If we see "a class" we consider that abstract class may include in it also, isn't it?
Mushfiq Mammadov wrote:"Which statements are true.." questions are harder questions for me than others.
[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: Remember that these will be easier on the real exam because the exam tells you how many are correct. (We don't to make it more challenging - you learn more from the harder questions.) If you know there are 2 correct answers and only see 1, you are going to keep looking for what else could be correct. Or you'd look for which ones are definitely wrong and see what is left.
Jeanne Boyarsky wrote:
Mushfiq Mammadov wrote:4. On page 295, review question #14:
I guess that the answer of this question is incorrect
Maybe authors intend to write “An abstract class” instead of “A class” in option B.
I think this one is correct in the book. An abstract class is a type of class. Which means it is possible for a class to implement the interface without implementing that method. The "trick" in the question is to see if you recognize that situation. Giving away in the answer that we are thinking about abstract classes makes it to easy.
Roel De Nijs wrote:The Cat class is a concrete (non-abstract) class and must implement the makeSound method, otherwise the code won't compile.Hope it helps!
Mushfiq Mammadov wrote:I considered "A class" as a concrete class therefore I think option B is correct
Everybody's invited. Even this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|