About Question enthuware.ocpjp.v8.2.1340 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin »

A superclass is not responsible for the subclass. A superclass is not obligated to make sure that a subclass will work logically or correctly. As long as a class's equals method adheres to the equals contract, it is valid irrespective of what the subclass does.

Equals contract does not mandate that a class and its subclass objects must work well when added to a Set. So just because adding GoodOne and ExtendedGoodOne objects in a Set is not working as per your expectation, doesn't mean GoodOne's equals implementation is invalid.

HTH,
Paul.
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 43 guests