23.aggregation in Java
23.aggregation in Java
Vishnu
Aggregation in java
Aggregation is a type of HAS-A relationship. Aggregation represents a type of
relationship between two objects in which one contain the other’s reference. Two
objects can exist independently. If one is deleted other can still exist.
Let us take the example: A room has a chair. Here room object contain the chair object.
Both room and chair exist independently.
Example:
package com.vishnu;
Output:
1
Sri Sureka Technologies, NearAndraBank,Opposite Geethanjali High School, Near S.R.Nagar
UmeshChandraStachu, S.R.Nagar, Hyderabad-500038, Ph: 040-66616677, Mobile: +91-9885602332.