posted 18 years ago
The Object class defines a method called equals that is inherited by all classes.
This method allows us to define what it means for two different objects to be meaningfully equal.
However, if a class does not override equals, then the default behavior is simply to check to see if the object reference calling the method and the object reference sent to the method refer to the same object.
Consider the following example.
first and second refer to different objects, but they are meaningfully equal.