I'm not very good at Java. But somehow i feel that, there is nothing wrong with the equals comparison in option D. it doesn't break any contact of equals comparison. So, both options C and D are correct.
i think the hashcode implementation is not correct in this particular case. As per the hashCode contract:
"If two Objects are equal as according to equals method then calling the hashCode() method on each of the two objects must produce the same integer result"
this doesn't say other way round. So, i think the equals comparison is correct in both the options. And the hashCode implementation is not correct.
PLEASE CORRECT ME IF I'M WRONG.
-Aravind<br />SCJP 5.0 (91%), Preparing for SCBCD.