Originally posted by Steve Jensen:
So, by specifying 'o', we should be accepting one paramater, not 2 (102 and 24)
We specify the Class of the argument and a variable. The class is Test and the variable name is o. A class is a collection of data and behavior. In our particular instance, Class Test contains two integers: a and b, and a couple of methods, main and equals. The equals method compares the object we called the method on to the one passed in as an argument. That's why in this line from the equals method:
if (o.a == a && o.b == b) return true; we have 2 variables named a. o.a is the integer passed into equals through the instance of Test named o. In the example I specified above we call the equals method like this:
ob1.equals(ob2) inside the equals method, a = 100 and o.a = 102. I changed the values from what you had before to make it a little clearer.
[ November 14, 2003: Message edited by: Joe Ess ]