If x.equals(y) is false, then x==y may be true [FALSE]
cmbhatt
cmbhatt
Thanks Anil and Sharan to stick to the true facts. I think we should generally adhere to the facts pointed by Anil and Sharan.
cmbhatt
If class Dog follows the equals the equals and hashCode contracts, and
if x and y are reference variables for two Dog objects, which statements are true? (Choose all that apply)
A. If x.equals(y) is true, then x==y must be true
B. If x.equals(y) is false, then x==y may be true
C. If x.equals(y) is true, then x==y may be false
D. If x.equals(y) is true, then (x.hashCode() == y.hashCode()) may be
false.
E. If x.equals(y) is false, then (x.hashCode()==y.hashCode()) may be true
F. If x==y is false, then x.equals(y) must be false.
cmbhatt
Originally posted by madhu v pe:
Hi All,
Please any one can clarify the foll statement from K&B-Overrding equals() topic.
Thanks
cmbhatt
We should throw him a surprise party. It will cheer him up. We can use this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|