File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Sierra/Bates Ch 5 Self Test #5 (aggregation) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Sierra/Bates Ch 5 Self Test #5 (aggregation)" Watch "Sierra/Bates Ch 5 Self Test #5 (aggregation)" New topic
Author

Sierra/Bates Ch 5 Self Test #5 (aggregation)

Marlene Miller
Ranch Hand

Joined: Mar 05, 2003
Posts: 1391
class C {}
class A { C c = new C(); }
class B extends A {}
Is there an aggregation from B to C? I think not. The relationship is between A and C.
In UML diagrams, when they draw an aggregation from one class A to another C, they do not draw an aggregation from the subclasses of A to C.
In the UML Reference Manual inheritance is a concept related to but distinct from the generalization relationship. Inheritance is a mechanism for combining shared incremental descriptions to form a full description of an element.
In the UML Reference Manual they say an aggregation relationship is transitive across all aggregation links. If A aggregates B and B aggregates C then A aggregates C. They do not say If A aggregates C and B extends A then B aggregates C.
[ April 17, 2003: Message edited by: Marlene Miller ]
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
I think this question is really about is-a and has-a. When I answered it, I mentally reworded it to ask "Does B have-a C?". The answer is yes, by inheritance from class A.


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Kathy Sierra
Cowgirl and Author
Ranch Hand

Joined: Oct 10, 2002
Posts: 1572
Originally posted by Barry Gaunt:
I think this question is really about is-a and has-a. When I answered it, I mentally reworded it to ask "Does B have-a C?". The answer is yes, by inheritance from class A.

Yep --the way Barry is thinking about it is *exactly* what the question is looking for.
In fact, on the real SCJP, we deliberately made the exam objectives for is-a and has-a no more precise than we did, because we are testing ONLY for whether you understand the fundamentals of is-a and has-a, period.
It is the high-level nature of those two relationships that matter. More fine-grained distinctions of composition and aggregation, and/or UMLspecifics are tested only by the Architect exam (and I think one of the IBM exams).
I'm going to open another topic in just a moment, though, because I *have* been seeing some confusion about just how deep and detailed the exam gets, especially in obscure areas of the spec (the exam does NOT), and I just want to make sure that newcomers here aren't becoming worried about the nature (and scope) of the exam. What *is* on the exam, and the way the questions are worded, is challenging enough as it is
cheers,
Kathy
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Sierra/Bates Ch 5 Self Test #5 (aggregation)
 
Similar Threads
what is aggression and how it differs from inheritence...
Question of prasks on UML
Is has-a transitive?
isn't interface support inheritance
Has-A relationship