Doubt on practice exams - OCP Java by kathy sierra and barty bates
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
54 Given:
Which are true? (Choose all that apply.)
A. Glanks have a Bostron.
B. Jookers implement Protefors.
C. Glanks implement Bostrons.
D. Jookers have a String.
E. Bostrons implement Vonks.
F. Bostrons have a Bostron.
Answer (for Objective 5.5):
A, D, and F correctly describe some of the relationships within the code. Glanks have
Bostrons indirectly through Jookers. Jookers have Strings indirectly through Bostrons, and
Bostrons have Bostrons because it’s very common to want to make linked lists with your
Bostrons.
B and E are incorrect because no such hierarchies exist in the code. C is incorrect because
Glanks “have” Bostrons (indirectly), but they don’t implement them.
in my first guess just F is correct... I've seen mock exams (MasterExam I think) that DOES NOT consider indirect relationships
I'm a little confused in what should I mark on the real exam
this means, Bostron have a String and not Jooker (Jooker have a Bostron)
on the real exam I should always consider indirect relationships?
thanks
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
i also don't get it
what does it mean exactly by : Jookers have a String. ?
i think it would be correct if jooker had extended Bostron class or it could make an insatnce of Bostron class in the second case Bostron class should have been not
abstract...because we can not make insatnace of abstract classes
woudl anybody shows us with example how come we print out the string from the jooker class?
``Worry does not empty tomorrow of its sorrow; it empties today of its strength.''
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Just as indirect IS-A relationships exist (Superclass - subclass - subsubclass), indirect HAS-A relationships can exist too.
So, A D F are correct. B E are not.
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Hama Kamal wrote:
i think it would be correct if jooker had extended Bostron class or it could make an insatnce of Bostron class in the second case Bostron class should have been not
abstract...because we can not make insatnace of abstract classes
woudl anybody shows us with example how come we print out the string from the jooker class?
But we can make instance of an anonymous subclass of abstract Bostron class, check this out:
So see no need to make Bostron class concrete (not abstract).
Piyush
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Hama wrote:would anybody shows us with example how come we print out the string from the jooker class?
Hello Hama, below is an example of how to take care of your doubts, you can use the same approach with interfaces
you need to practice a lot of code writing to keep you in good shape for the exams.
Output:
Regards
Ikpefua
OCPJP 6.
In Your Pursuit Towards Certification, NEVER Give Up.
| Doody calls. I would really rather that it didn't. Comfort me wise and sterile tiny ad: The new gardening playing cards kickstarter is now live! https://www.kickstarter.com/projects/paulwheaton/garden-cards |







