Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

override equals

 
Haythem Ben Yahia
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic