As the Aggregation and Composition is related Association or we can say it gives the understanding of relationship between object or anything else.
I posted this que
A would like to add additional information to explained answers
Aggregation is a special form of Assosation (Association is relation between two separate classes which establishes through their Objects. Association can be one-to-one, one-to-many, many-to-one, many-to-many)
Composition is a restricted form of Aggregation in which two entities are highly dependent on each other.
Aggregation vs Composition
- Dependency: Aggregation implies a relationship where the child can exist independently of the parent. For example, Department and Employee, delete the Department and the Employee still exist. whereas Composition implies a relationship where the child cannot exist independent of the parent. Example: Human and heart, heart don’t exist separate to a Human.
- Type of Relationship: Aggregation relation is “has-a” and composition is “part-of” relation.
- Type of association: Composition is a strong Association whereas Aggregation is a weak Association.
Reference: https://www.geeksforgeeks.org/association-composition-aggregation-java/