Page 1 of 1

About Question enthuware.ocpjp.v7.2.1515 :

Posted: Sat Aug 17, 2013 5:32 am
by Wisevolk
I don't agree with the answer.

It's true to say we can't be sure about equality of two object with the hascode method.

but, for inequality it's the same as 2 non equal objects should have the same hascode. So testing the inequality with a hascode can't give a sure answer about inequality.

Re: About Question enthuware.ocpjp.v7.2.1515 :

Posted: Sat Aug 17, 2013 5:59 am
by admin
This is what it means - if the two hashcodes are equal, we can't say whether the objects are equal or not. But if two hashcodes are not equal, we can be sure that the objects are not equal.

HTH,
Paul.

Re: About Question enthuware.ocpjp.v7.2.1515 :

Posted: Fri Oct 18, 2013 10:48 am
by DesRenthuware
Two typos:

"...the equals and hashCode contracted not violated..."

and

"...if the hash codes for two objects is same, you..."

Cheers

Re: About Question enthuware.ocpjp.v7.2.1515 :

Posted: Sat Oct 19, 2013 9:58 am
by admin
Fixed.
thank you for your feedback!
Paul.