What is composition in Java with example?

A composition in Java between two objects associated with each other exists when there is a strong relationship between one class and another . Other classes cannot exist without the owner or parent class. For example, A ‘Human’ class is a composition of Heart and lungs. When the human object dies, nobody parts exist.

Read more

What is the main difference between aggregation and composition?

Difference between Aggregation and Composition AggregationCompositionAggregation is a part of an association relationship.The composition is a part of an association relationship.Aggregation is considered as a weak type of association.The composition is considered as a strong type of association.Difference Between Aggregation and Composition in UML – Guru99 www.guru99.com › uml-aggregation-vs-composition

Read more