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
I want to learn java

Introduction As an alternative to the Binary Search algorithm, also it could be done by the brute-force method given below. public static int rank(int key, int[] a) {     f

1. Write the pseudocode to get the input of 10 integers from the user and add them up and output the total. (4 points) 2. Compute the output of following pseudocode. Assume that

What limitations are placed on method overriding ?

What is Documentation for the class library Sun gives a large amount of documentation for the classes, interface's and exceptions in the class library. If you've installed the

How Polylines draws in java language? Java automatically closes the polygons it draws. That is it draws polygons which look like the one on the right rather than the one on the

Normal 0 false false false EN-US X-NONE X-NONE

Explain init(), start(), stop(), and destroy() method? The init() method is known as exactly once in an applet's life, while the applet is first loaded. It's generally used to


In JavaScript, what is event handling? What are the two types of events? In JavaScript capturing events and responding to them is event handling. The system sends events to the