Comparing two different objects in one method

Im new to Java and need help solving this probably simple problem.

I have two classes. One class is called circle which holds the radius and the position of each circle and one class that extends applet which I use array lists to create multiple circle objects. I want to put the collision tester in the circle class but I am stuck on how to implement this. I assume I would call the method like: circle.get(0).collision(circle.get(1)) but how do I access the variables (such as the radius and the positions) of the first circle? What should I set the parameters to be? I know about the "this" reference but I just can't make it work.

Any help would be appreciated!

[685 byte] By [Mr_Smileya] at [2007-11-27 5:10:35]
# 1

Assuming a lot here.

The collision method is in your Circle class. So when you call collision you will be inside one Circle object and you pass the second Circle object as a parameter. Therefore you can access variables of both objects.

public boolean collision(Circle other) {

this.radius compared to other.radius

return true/false

}

floundera at 2007-7-12 10:30:43 > top of Java-index,Java Essentials,Java Programming...