wood burning stoves
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes has-a. equals (maintains No Relationship) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "has-a. equals (maintains No Relationship)" Watch "has-a. equals (maintains No Relationship)" New topic

has-a. equals (maintains No Relationship)

Louie van Bommel
Ranch Hand

Joined: Aug 17, 2004
Posts: 76
I found this on a mock exam.

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

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?
Corey McGlone
Ranch Hand

Joined: Dec 20, 2001
Posts: 3271
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.

SCJP Tipline, etc.
Edwin Keeton
Ranch Hand

Joined: Jul 10, 2002
Posts: 214

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.

I agree. Here's the link: http://aspose.com/file-tools
subject: has-a. equals (maintains No Relationship)
It's not a secret anymore!