Saturday, November 25, 2006

Aggregataion vs Composition

Well, not specifically to java, but one could get the interview question like following:

What is the difference between Aggregation and Composition? Give one example.

Basically, they differ in the life cycle of the aggregated or composed object. The composed objects have life same as that of parent object or container object. For example, think!!!!

Sighting an example in front of interview could be quite challenging because that’s where the next question starts. So, get hold of above question before you go for a senior level java/C++ position in a good company.

Cheers