Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

equals() not working as expected

807589Jan 5 2009 — edited Jan 5 2009
Hi everyone -

I have two objects lets say "one" and "two".
In these objects I have overridden the equals(), hashCode() and toString() methods. When I call one.equals(two) or two.equals(one) it is true as I expect.
If I call one.hasCode() and two.hashCode() the values are the same.

But, for some reason when I can one.toString().equals(two.toString()) I get false?

Any help is appreciated! Thanks :)
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 2 2009
Added on Jan 5 2009
22 comments
474 views