Originally posted by Corey McGlone:
It just doesn't make sense for two entirely different types of objects to be "equal." However, had you done this:
Maybe another way to think about it, if it helps to resolve the confusion, is this:
Sun had something in particular in mind when they created the 'equals' method. There is a moral contract it is expected to obey. That contract is "only return true if the implementation of the two objects is equivalent".
That isn't the same as "only return true if the two objects could be thought of has having equivalent values for some particular purpose".
The Sun notion of equals is more stringent, and really better from an OO programming standpoint. It allows you to have a reasonable expectation that you could use X and Y interchangeably in a wide variety of situations, although there are some limitations to that.