In this article, we discussed Association in Java. If we want to establish connections between two classes then we can use any type of association according to the need. If the objects are independent of each other, we use Aggregation and if they are dependent then we use Composition .
Read moreWhere is Aggregation used?
Aggregation should be used only in cases where there is a compositional relationship between classes , where one class is composed of other classes, where the “parts” are incomplete outside the context of the whole.
Read more