This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes override equals Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "override equals" Watch "override equals" New topic
Author

override equals

Haythem Ben Yahia
Greenhorn

Joined: Nov 29, 2012
Posts: 14
hi,
i'm studying with the book of kathy Sierra and i wanna pass the SCJP but i foud a problem:
i didn't understand why we used to override equals() at the page 582.what is the goal of doing that.
thank you
Haythem Ben Yahia
Greenhorn

Joined: Nov 29, 2012
Posts: 14
i found the problem.the original equals() it is like ==.so x.equals(y) return true if & if only x==y.
if 2 objects have the same parameter then it will be not equal with this method.so we need to modify it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: override equals
 
Similar Threads
about equals
object equals() method
Map and Set
Invoking Object superclass's method outside of subclass when the method is overriden?
compare object