The moose likes Beginning Java and the fly likes Relationship between classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Relationship between classes" Watch "Relationship between classes" New topic

Relationship between classes

david colais

Joined: Nov 15, 2010
Posts: 29
Hi guys...
How to represent the relationship classes btw classes in code for eg:if association or genralization is asked to represent in code.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63841

Please use real words when posting to the forums. Abbreviations such as "btw" in place of "between" only serve to make your posts more difficult to read and less likely to generate useful responses.

Please click this link ⇒ UseRealWords for more information.

[Asking smart questions] [About Bear] [Books by Bear]
Greg Brannon

Joined: Oct 24, 2010
Posts: 563
Please restate your question. What are you trying to do? Can you give an example of a situation that requires defining or coding the relationship between classes?

Always learning Java, currently using Eclipse on Fedora.
Linux user#: 501795
david colais

Joined: Nov 15, 2010
Posts: 29
Sorry for not being clear...
@Greg Brannon :What i wanted to ask was that how should i implemement the code if there is a generalization relationship for example:Like if a truck is made up a number of parts.
My doubt is that how do i represent this reationship between two calsses of truck and parts in the code.
Is it there to just help us understand the situation or do we need to implement the relationship in the code.Please help........
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46337
I always thought "btw" meant "by the way", which is another reason for not using such abbreviations.

You will find discussion about aggregation association and composition here. you will have to read the whole thread to find where the mistake was made.
I agree. Here's the link:
subject: Relationship between classes
It's not a secret anymore!