Hi,

I have a question. If I have a class with a method that requires a parameter which is an instance of another class, how should I write the code for a method in that class which inputs the parameter.

Here is some example code, to clarify my question:

Here's the first class, which has the method which requires an object as a parameter

public ClassA{
//instance vars, constructor

// method
public void methodA(ClassB B){
}
}

Here's the second class

public ClassB{
//instance vars, constructor

// method
public void methodB(){
ClassA.methodA(this)
}
}

Im interested in the bold part. Is it the correct parameter for the method?


Thanks!

Niels