• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

HAS-A relationship in indirect class members?

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
In following code


The question I want to ask is if this is true? :-
A "HAS-A" C is true?

though C is not directly member of A though?

and another question is if anyone can tell that regarding multiple-choice questions in OCPJP 6 , the choice is given like (Choose 3(or2)) or (Choose all that apply)?
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think A "has a " C is false in your example. The implementation of B could be anything. It could change over time. It's none of A's business what is inside B.

The real exam will tell you how many answers are correct. You will not see "choose all that apply." Many study guide books use "choose all that apply" to make the questions harder. The idea is that if you can get it right in practice without knowing how many are correct, you will certainly get it right on the exam.
 
Swaraj Pal
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Jeanne for your reply , i thought the same for it being false but on Free Exam on whizlabs i got it incorrect .
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The real exam doesn't reply on such subtleties of language, so don't worry.

They can ask about indirect has-a, but it would look more like this where A really does have a C. (Because it inherits it)



 
Why does your bag say "bombs"? The reason I ask is that my bag says "tiny ads" and it has stuff like this:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic