What is aggregation and composition ?



What is aggregation and composition ?..

Answer / 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

More Core Java Interview Questions

Does sprintf allocate memory?

0 Answers  


What is used of static keyword in java?

0 Answers   Cyient,


What is an Iterator interface?

2 Answers  


Can a function return a function?

0 Answers  


Is it possible to compare various strings with the help of == operator?

0 Answers  






What is the difference between interpreter and compiling ?

7 Answers   TCS,


What are the limitations for static method?

3 Answers   Greenwood,


What is runtime locatable code?

0 Answers   Cognizant,


What are the steps in the jdbc connection?

0 Answers  


What are virtual methods?

1 Answers   TCS,


How are observer and observable used in java programming?

0 Answers  


How the metacharacters are different from the ordinary characters?

0 Answers  


Categories