Originally posted by Keith Lynn:
One point of confusion I think you have is with where the equals method is implemented. It should be placed inside your class definitions.
Originally posted by Gabriel White:
Thanks Keith, but why? It will work if I call the correct object won't it?
Short answer: because this is the way it works in
Java.
Slightly longer answer: Ever class inherits the equals() method from Object, as already mentioned. Often the default implementation is not what you need, so you have to override it.
In order to override the equals() method, you first need to clearly define what it means for two objects to be "equal". So what does it mean for two Sphere objects to be equal? You might want to see what data you are using to represent the sphere. This should help in figuring this part out.
Please post your ideas. For now a (mostly) English description is desirable. From there we will be glad to help you with the syntax to implement it.
Layne