What is aggregation and composition ?

Answer Posted / balbir

Aggregation differs from ordinary composition in that it
does not imply ownership. In composition, when the owning
object is destroyed, so are the contained objects. In
aggregation, this is not necessarily true. For example, a
university owns various departments (e.g., chemistry), and
each department has a number of professors. If the
university closes, the departments will no longer exist,
but the professors in those departments will continue to
exist. Therefore, a University can be seen as a composition
of departments, whereas departments have an aggregation of
professors. In addition, a Professor could work in more
than one department, but a department could not be part of
more than one university

Is This Answer Correct ?    6 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why packages are used?

814


How can we make copy of a java object?

762


Does java allow default arguments?

767


Which is the class in java?

717


Can we declare array without size in java?

737


What is io stream in java?

725


What is a container in a gui?

724


How do you add an element to a set in java?

753


What advantage do java's layout managers provide over traditional windowing systems?

731


Hi Anyone know the model / questions of the Federal bank sample questions for the post of Specialist Officers - Programmers. Please post if anyone have..

2047


what is meant by HQL?

818


What is the right data type to represent a price in java?

738


Can a class be final?

690


Is arraylist an object in java?

802


What language is pass by reference?

760