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 have got project of Vending machine. would you please help me about how to start and how to use coding.thanks

Need java programmer for an assignment "Prepare a program that will accept a sequence of file names as command-line arguments. These files will consist of ASCII text representin

Describe Graphics Objects ? In Java all drawing takes place via a Graphics object. This is an example of the class java.awt.Graphics. Initially the Graphics object you use w

What is the purpose of garbage collection in Java, and when is it used? The purpose of garbage collection is to identify and discard objects that are no longer required by a pr

What limitations are placed on method overriding ?

GUI-Based Application Objectives:   (1)   Learning how to write a GUI-based application in Java. (2) Learning how to write an event driven application program in Java.

What is JDBC exactly? Describe the steps required to execute a SQL query using JDBC.

SudCell and Simple Sudoku Implementation We describe, fully, the SudCell class that will represent each of the 81 cells or boxes in a Sudoku puzzle.  Then we will

Explain the concept of Multi-Threaded- JAVA Java has a concept of concurrency wired right in to the language itself. This works out more cleanly than languages where concur

String concatenation and comparison public class StringTest { public static void main(String[] args) { int i = 4; int j = 5; System.out.println ("Hello" + i); // wi