Java - Association , Aggregation & Composition

Association :

  • Object can have independent life cycle
  • No ownership between objects.
  • For Example,
If we remove any student no need to remove teacher.
If we remove any teacher no need to remove student.

Aggregation:
  • Object can have independent life cycle.
  • There is a Ownership
  • For Example,
If we remove battery from phone we need to wait for another phone.

Composition:
  • Object don't have independent life cycle.
  • parent object is deleted all child object will also be deleted.

Comments

Popular posts from this blog

How to set Java Object into JaxBElement ?

GitLab