Surely the only possible implementation is that all objects get the same hashCode? Equal objects must have an equal hashCode, no?You should think about what would be an appropriate implementation of the hashCode method if you use this code for the equals method.
About Question enthuware.ocpjp.v8.2.1808 :
Moderators: Site Manager, fjwalraven
-
- Posts: 125
- Joined: Thu Jul 05, 2018 6:44 pm
- Contact:
About Question enthuware.ocpjp.v8.2.1808 :
-
- Site Admin
- Posts: 10385
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1808 :
Correct. You got it 

-
- Posts: 125
- Joined: Thu Jul 05, 2018 6:44 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1808 :
OK great, thanks very much.
-
- Posts: 1
- Joined: Thu May 31, 2018 4:58 am
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1808 :
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.
-
- Site Admin
- Posts: 10385
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1808 :
Yes, it should be "reference" not "return". Fixed.
thank you for your feedback!
thank you for your feedback!
-
- Posts: 85
- Joined: Mon Dec 24, 2018 6:24 pm
- Contact:
-
- Site Admin
- Posts: 10385
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1808 :
Yes, but always post code to make sure there is no misunderstanding about your question.
Who is online
Users browsing this forum: Bing [Bot] and 16 guests