Why use aggregation in Java?

Java Programming Java8Object Oriented Programming

Aggregation

When an object A contains a reference to another object B or we can say Object A has a HAS-A relationship with Object B, then it is termed as Aggregation.

Aggregation helps in reusing the code. Object B can have utility methods and which can be utilized by multiple objects. Whichever class has object B then it can utilize its methods.

raja
Published on 22-Apr-2018 20:58:00
Advertisements