What is Orientation, Association, Aggregation and Composition in java

Hello Dear Reder, In this article, we are discussing what is Orientation, Association, Aggregation as well as Composition in Java Language. I will try to give some Real-world Examples which makes it easy to understand for you. 


"composition in java" "aggregation in java" "composition and aggregation in java" "composition example in java" "association aggregation and composition in java" "aggregation in java example" "difference between aggregation and composition in java" "association composition and aggregation in java" "class relationship in java" "association and aggregation in java" "difference between composition and aggregation in java" "composition relationship java" "aggregation and association in java" "uses a relationship in java"

Orientation, Association, Aggregation and Composition in Java 


📝Orientation: Seeing or pursue everything around as an object. is called as object-orientation.
  • java sees everything around its self as an object. hance it is an object-oriented programming language.

📝Association ( Has – A Relationship ): Association is one of the concepts of Object Orientation which is also called as Has–A Relationship.

It is a process of one or many Objects getting associated with another Object.

There are 2 forms of Association : 

I. Composition.
II. Aggregation. 


📝Composition: A composition is a special form of association. where an associated Object can not logically independently exists on its own without Owner Object.
  • If Owner Object is destroyed. then the associated object is also destroyed. Hence it is called Strong Has – A Relationship.

Example of Composition: Plant and Leaves.
"composition in java" "aggregation in java" "composition and aggregation in java" "composition example in java" "association aggregation and composition in java" "aggregation in java example" "difference between aggregation and composition in java" "association composition and aggregation in java" "class relationship in java, association and aggregation in java" "difference between composition and aggregation in java" "composition relationship java" "aggregation and association in java" "uses a relationship in java"
                                                                 

  • The plant is a whole and Leaves are parts. If the plant is destroyed. then all corresponding Leaves for that Plant should be destroyed.


One More Example: Human and Heart.
"aggregation in java" "data aggregation" "aggregation in java" "composition and aggregation in java" "aggregation example in java" "association aggregation and composition in java" "aggregation in java example" "difference between aggregation and composition in java" "association composition and aggregation in java" "association and aggregation in java" "java stream aggregate" "difference between composition and aggregation in java" "composition relationship java" "aggregate object in java" "aggregation and association in java" "association in java javatpoint"


 📝Aggregation: An aggregation is a special form of association. where an associated Object can logically independently exist even without the Owner Object.

  • If Owner Object is destroyed still an associated Object can exist. Hence it is called Weak Has – A Relationship.  

Example of Aggregation: Driver and Car.
"aggregation in java" "data aggregation" "aggregation in java" "composition and aggregation in java" "aggregation example in java" "association aggregation and composition in java" "aggregation in java example" "difference between aggregation and composition in java" "association composition and aggregation in java" "association and aggregation in java" "java stream aggregate" "difference between composition and aggregation in java" "composition relationship java" "aggregate object in java" "aggregation and association in java" "association in java javatpoint"


       

  •    If Driver Object is destroyed it will not affect Car Object and Vise-Versa.

Example (2): Employee and company.
                                           
"aggregation in java" "data aggregation" "aggregation in java" "composition and aggregation in java" "aggregation example in java" "association aggregation and composition in java" "aggregation in java example" "difference between aggregation and composition in java" "association composition and aggregation in java" "association and aggregation in java" "java stream aggregate" "difference between composition and aggregation in java" "composition relationship java" "aggregate object in java" "aggregation and association in java" "association in java javatpoint"

Admin Words:- Hopefully, now you can understand Orientation, Association, Aggregation, and Composition. if you still confused then please remind us to comment below of this post I will try to make it more easy for you. And stay away to learn programs J with Us. and also Read our Next Program.


    Recommended: - 

    Post a Comment

    0 Comments