What is aggregation in Java?
Anonymous
Answer: Aggregation is best defined as the entity reference where it represents the relationship between two classes where the aggregate class contains a reference to the class which it owns. Aggregation represents a has-a and whole/part relationship. For example consider an aggregate class Employee stores information such as name, age, salary, and the Address class stores information such as city, state, and pin-code. Now, if the Employee class is defined to contain an Address object then it will be said that the Employee object has-a Address object. The Address object also makes up part-of Employee object – there is no employee without any address to live. Therefore, the Employee object owns the Address object.
Check out your Company Bowl for anonymous work chats.