WHAT IS AGGREGATION AND HOW IT MAPS INTO A JAVA CLASS?

Rajesh Goswami

Total Post:29

Points:203
Posted by  Rajesh Goswami
Java 
 1887  View(s)
Ratings:
Rate this:
Aggregation show the part of relationship how use it in java or mapping with java class?
  1. Amit Singh

    Post:103

    Points:721
    Re: What is Aggregation and how it maps into a Java class?

    An Aggregation is an Association which denotes an "is part of" relationship.

    Take a 'Car', for example, it is consisted of an engine,a steering wheel, four tires,seats,gear box,fuel tank,engine oil tank, air filters etc.So all constituents of car are parts of it.

    If a car is destroyed/smashed, its parts can still be used separately as spares in other cars,so these parts have individual use even when their conatiner entity is destroyed.

    Example
    class Car
    {
    List getTires();
    List getSeats();
    List getAllParts();
    }

      Modified On Apr-16-2011 02:55:32 AM

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!