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

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
normc
Posts: 5
Joined: Thu Apr 19, 2012 2:18 pm
Contact:

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

Post 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.

admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post 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.

Lodengruen
Posts: 5
Joined: Fri Oct 11, 2013 11:21 am
Contact:

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

Post 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!

admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin »

You are right. This question is not too clear and should be fixed. Thank you for your feedback!

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 2 guests