• 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. equals (maintains No Relationship)

 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I found this on a mock exam.



Which statements are true about the relationship between ClassA and ClassB?

Answer:
1. Class1 maintains no relationship with Class2
2. The relationship can be described with a has-A.



(I chose #2, and not #1)

It seems to me that Class2 has-a Class1
and Class1 and Class2 enjoy a "has-a" relationship.

Is this kind of wording "maintains no relationship with" likely to appear on the exam? If so, why do you suppose I didn't pick answer #1?
 
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I doubt you'll see such a question on the exam. And, if you do, I can almost guarantee that the wording will be much less ambiguous than that.

From that question, I'd say you selected the correct answer.
 
Ranch Hand
Posts: 214
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the sample, Class2 does maintain a relationship (the has-A kind) with Class1. But the relationship between Class2 and Class1 is uni-directional since Class1 does not maintain a relationship with Class2.

(A relationship between classes is "maintained" by a class holding a reference to another class. Class2 holds a reference to Class1 whereas Class1 does not hold a reference to Class2).

The question asks about the relationship between Class1 and Class2, not about the relationship between Class2 and Class1.

Based on this interpretation of the question, answer 1 is correct.

On the real exam you won't have questions requiring this much subtlety of interpretation.
 
Doe, a deer, a female deer. Ray, a pockeful of sun. Me, a name, I call my tiny ad ...
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic