This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes What are the advantages when we do like this? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "What are the advantages when we do like this?" Watch "What are the advantages when we do like this?" New topic
Author

What are the advantages when we do like this?

bilal haider
Ranch Hand

Joined: Feb 08, 2011
Posts: 47

Mohamed Sanaulla
Bartender

Joined: Sep 08, 2007
Posts: 2928
    
  15

Bilal, Welcome to JavaRanch

Please TellTheDetails - And what is that you want to do? Also any exceptions you have with the code?


Mohamed Sanaulla | My Blog
bilal haider
Ranch Hand

Joined: Feb 08, 2011
Posts: 47

A is contating an object of b which is containing a hashset of A.
There is no error or exception ... I just want to know that what are the advantages of this kind of containment?
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

Let's say you have this:


Can you see now what it is used for?


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
bilal haider
Ranch Hand

Joined: Feb 08, 2011
Posts: 47

Thank you very much for the quick response, and moving me one step ahead.
What I understand is that Group class is containing distinct child objects.

But why we are containing group object in child object?
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Its is so you can see an association from both sides. From the Group instance you know what Child object the Group contains. From the Child object, you know what Group this particular Child object belongs to.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What are the advantages when we do like this?
 
Similar Threads
about import statement
mock exam qtn : how to refer class ?
class access
que from voodooexam
right way to peek inside others house.....:-)