Page 1 of 1

About Question com.enthuware.ets.scjp.v6.2.758 :

Posted: Wed Apr 25, 2012 10:26 am
by normc
I think the reader should assume proper implementation of the hashCode method. If you are assuming improper implementations, then this question would also be false: "The equals() method can be used to test the equality of two objects, true or false."
The answer should be true, even though a bad implementation of equals would return false.

Re: About Question com.enthuware.ets.scjp.v6.2.758 :

Posted: Wed Apr 25, 2012 10:58 am
by admin
Yes, the reader should assume a proper implementation and even with the proper implementation you cannot use hashCode() to test for equality but you can use it to test for inequality. The explanation explains why in detail.

Re: About Question com.enthuware.ets.scjp.v6.2.758 :

Posted: Thu Dec 05, 2013 10:30 am
by Lodengruen
I understand "testing for inequality" this way: The test should return true if and only if the objects are not equal.
But this is actualy not the case here: There may be objects which are not equal but their hashcodes are identical.
So I think the question is not precise, you can use the hashCode() method for finding SOME, but not ALL objects which are not equal to each other!

Re: About Question com.enthuware.ets.scjp.v6.2.758 :

Posted: Fri Dec 06, 2013 8:38 pm
by admin
You are right. This question is not too clear and should be fixed. Thank you for your feedback!