• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question of prasks on UML

 
Eduardo Cobian
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An UML diagram has a rectangle representing class A is connected by a solid line and a solid (dark) diamond near class A from class B.
In Java implementation
a.Class B will have a reference to Class A
b.Class A will have a reference to Class B
c.Class B has an aggregation relationship with Class A
d.Class A has an composition relationship with Class B
They say answer a is the correct one, but I think that also d is correct.
What do you think?
 
Eduardo Cobian
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My mistake.
They say that answer b is correct. What about answer d?
 
Shankar Ranganathan
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
D is not right because Class B has a composite relationship with class A
Thanks
Shankar Ranganath
 
Roshan Lal
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Eduardo Cobian:
My mistake.
They say that answer b is correct. What about answer d?

I have also taken this test. You have the same confusion which I had. The question is trying to differentiate between "Java Implementation ie code" and conceptual relationship. Conceptually
class A has composition relationship with B but when you code the class A it will have a reference to an instance of class B.
In fact, there is a repeat question on that test without the word "implementation" and the correct answer given is D.
Hope that helps
:-)
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic