Difference between composition and aggregation, JAVA Programming



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 just finished a small tutorial on JSP and servlet now I was looking for some assignments so that I can try my hands on

1) Listing of the source code ( named Rainfall.java ) for your program 2) Two sample output/execution/runs of your program Optional Group Work: This assignment may be done in

How Trojan Horses or Worms affect a computer system? What guidelines should be adopted to troubleshoot along with malicious software? Trojan horses are stand-alone programs. Th

frequently used java array method

In the previous assignments, we have developed an Asteroids game. In this assignment, we are going to use the same codebase to develop a different gameplay. The inspiration for thi

Question 1: a) What is the meaning of an object-oriented programming? b) List eight simple types of data in Java c) Explain how objects and classes are closely related.

Cryptography, the study of secret writing, has been around for a very long time, from simplistic techniques to sophisticated mathematical techniques. No matter what the form howeve

Write a program that finds the minimum total number of shelves, including the initial one required for this loading process

Write a Java program called SalesInfoMiner that reads in a file of products, stored in text format (2 lines per entry). The program must then read in information about past sales t