Only institute to provide recording daily after class to students. Only institute you can practice whole day under faculty guidance. Only institute where test and mockup tests are taken regularly. Only institute provides all mobile nos of old students on website.

Aggregtion in Java

If a class contains another class or object of another class as its member then Has-A relation is created between their class and their objects.

Aggregation represents part and whole relation between classes. It is weaker relation as both entity can exist independently.

For eg Room has chairs,Room has tables.

Aggregation can be implemented by containing the object of a class as member of another class.

Lets take an example of Employee and Address classes to implement aggregation. Here Address class object is a data member in Employee class.

Address.java

program of Address.java
Java By Kiran

Employee.java

program of Employee.java
Java By Kiran

AggregationTest.java

program of AggregationTest.java
Java By Kiran

Output

ID:1
Name:Raju
City:New Delhi
Zip Code:110083