In Exam Cram on pg. 299, question 10.2 is very puzzling to me.
Which of these statements are true?
a. If the reference x and y denote 2 different objects, then the expession x.equals(y) is always false.
b. If the reference x and y denote 2 different objects, then the expression (x.hashCode() == y.hashCode() is always false.
(I left out answers c,d,e because they are not relevant to my question)
I would have thought that both a. and b. were correct answers, but apparently not. The authors of the book give this reason, "Neither of the methods hashCode() and equals() is declared final in the Object() class, and it cannot be guaranteed that implementations of these methods will discriminate between all objects."
I cannot find anything in the
Java Spec that supports these statements. Can anyone out there in Java land tell me more?