What happens when comparing two instances of the same class,given - ProProfs Discuss
Advertisement

What happens when comparing two instances of the same class,given that the equals() and hashCode() methods have been properly overridden?

What happens when comparing two instances of the same class,given that the equals() and hashCode() methods have been properly overridden?<br/>

Change Image    Delete

Asked by RubiyaSameen, Last updated: Jan 07, 2025

+ Answer
Request
Question menu
Vote up Vote down

1 Answer

John Smith

John Smith

John Smith
John Smith

Answered May 23, 2017

If the equals()methood returns false,the hashCode() comparison==might return true.
If the hashCode() comparison==returns true,the equals() method might return true
If the hashCode() comparison!=returns true,the equals() method must return true
upvote downvote
Reply 

Advertisement
Advertisement
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader
Image Preview
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader
Image Preview
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader

Email Sent
We have sent an email to your address "" with instructions to reset your password.