Association in Java

Associate
Joined
4 Mar 2007
Posts
315
Location
United Kingdom
I have been trying to get my head around how an Association would work between two classes in Java. Could someone kindly explain how it works,
Is it just

Code:
Public Class mySubClass{

}

public Class myMainClass extends mySubClass{

}

or is that just a pure inheritance?
 
Code:
public class Member
{
}

public class Meeting
{
}

public class Attendance // association class
{
private Meeting meeting;
private Member member;
...
}

9 times out of 10 you could probably structure this better using seperate class files.
 
Code:
public class Member
{
}

public class Meeting
{
}

public class Attendance // association class
{
private Meeting meeting;
private Member member;
...
}

9 times out of 10 you could probably structure this better using seperate class files.

I take it in order to use external classes I would use something like this inside each class?

Code:
public void changeValue(newValue){
this.value = newValue;
}

Correct?
 
Back
Top Bottom