| Author |
question about "has a" at SUN's mock exam
|
dragon ji
Ranch Hand
Joined: Oct 31, 2002
Posts: 110
|
|
10. class A {} 11. class B { 12. private A myA = new A(); 13. } Which two statements are true about the relationship between class A and class B? (Choose two.) A A maintains no relationship with B B B maintains no relationship with A C B maintains a "one to many" relationship with A D The relationship can be described with a has-a clause E The relationship can be described with an is-a clause Answer: Options A and D are the correct answers but I think it should be option C and D,please explain it to me,thanx.
|
scjp 1.4<br />challenge haven't limit!
|
 |
Chloe Loh
Greenhorn
Joined: Aug 27, 2002
Posts: 22
|
|
The reason that... A is true: In the example here, classB holds one classA object, which creates 'has a' relationship that classB has an object of classA but this relationship is not maintained by classA but classB since class A doesn't hold any information of this relationship and no change need to be made on classA should the relationship of these two classes be changed. C is false: There will be only one classA object be created when a classB object is created. It is a " one to one" relationship exists in this example but not "one to many". I hope this will help....
|
 |
dragon ji
Ranch Hand
Joined: Oct 31, 2002
Posts: 110
|
|
|
thanks a lot,Chloe!
|
 |
 |
|
|
subject: question about "has a" at SUN's mock exam
|
|
|