Page 1 of 1

About Question enthuware.ocpjp.v8.2.1808 :

Posted: Tue Jul 31, 2018 8:34 pm
by __JJ__
You should think about what would be an appropriate implementation of the hashCode method if you use this code for the equals method.
Surely the only possible implementation is that all objects get the same hashCode? Equal objects must have an equal hashCode, no?

Re: About Question enthuware.ocpjp.v8.2.1808 :

Posted: Tue Jul 31, 2018 11:09 pm
by admin
Correct. You got it :)

Re: About Question enthuware.ocpjp.v8.2.1808 :

Posted: Wed Aug 01, 2018 9:25 am
by __JJ__
OK great, thanks very much.

Re: About Question enthuware.ocpjp.v8.2.1808 :

Posted: Tue Oct 16, 2018 6:49 am
by NickRobinson
The answer for the second option states "Therefore, you cannot override it with a method whose argument has a different return type." Should this be "reference type" ? The return type is boolean in both cases.

Re: About Question enthuware.ocpjp.v8.2.1808 :

Posted: Tue Oct 16, 2018 7:17 am
by admin
Yes, it should be "reference" not "return". Fixed.
thank you for your feedback!

Re: About Question enthuware.ocpjp.v8.2.1808 :

Posted: Sun Mar 03, 2019 12:24 pm
by crazymind
admin wrote:
Tue Jul 31, 2018 11:09 pm
Correct. You got it :)
Can I return isbn or name for hashcode in this case? cause they are both subset of variables that equals use.

Re: About Question enthuware.ocpjp.v8.2.1808 :

Posted: Sun Mar 03, 2019 1:14 pm
by admin
Yes, but always post code to make sure there is no misunderstanding about your question.