Difference between composition and aggregation, JAVA Programming

Aggregation

Composition

Aggregation :  An  association   in  which  one  class refers to collection or a another class. This is a part of  a  whole   relationship  where  the  phase   can  exist without the whole .

e.g.: A line item is whole and the products are the phases. If a line item is deleted then the products have not be deleted .

Composition :  An  association   in  which  one  class  refers  to another class or a collection. This is a part of a whole relationship where  the  phase   cannot  implement  without  the  whole .  If  the  whole  is deleted then the parts are deleted.  For example:  An Order is a whole and the line items are the phase. If an order is removed then all the line items should be deleted as well.

Aggregations are not used to be circular.

In  a  garbage-collected  language  like  Java,  The  whole   has  the responsibility of  operating   the  garbage  collector  to  prematurely collect the part by holding reference to it.

Posted Date: 7/27/2012 5:30:44 AM | Location : United States







Related Discussions:- Difference between composition and aggregation, Assignment Help, Ask Question on Difference between composition and aggregation, Get Answer, Expert's Help, Difference between composition and aggregation Discussions

Write discussion on Difference between composition and aggregation
Your posts are moderated
Related Questions
List the unexpected quotients in java? 2/3 = 0 3/2 = 1 1/0 = ArithmeticException 0/0 = ArithmeticException 1.0/0.0 = Inf 1.0/0 = Inf 0.0/0.0 = NaN -1.0/0.0

Question : (a) Class file verification in CLDC is different from class file verification in J2SE. Explain and discuss how and why it is different, illustrating your answer

How does an exception permeate through the code? An unhandled exception moves up the method stack in search of a matching When an exception is thrown from a code which is wrapp

I need a DCS (Source code and JAR) to process packets from a cheap chinese GPS TK110, the unit is already communicating with the server but is not parsing. So I need someone with e

Type casting defines treating a variable of one type as though it is another type. When up casting primitives as given below from left to right, automatic conversion happens. Bu

Advantages offered by SOA Splits down the silos of data, functionalities, and applications into enterprise services. Adapts an application to changing business requirements

AJAX- HTML- XML- CSS and  Tomcat used in Java: Project Title: Zee Ads   Role                       : Developer Domain                  : Web Ads Environment

Java is Object oriented programme language Java is comprehensively OOP language with robust memory system Memory errors largely disappear due to safe pointers and garbage c

Explain Labeled Loops in details ? Generally inside nested loops break and continue exit the innermost enclosing loop. For instance consider the subsequent loops. for (int i=1

Question 1 What do you mean by Java Virtual Machine? Question 2 Write a simple Java program to display a string message and explain the steps of Compilation and execution in Jav