• Post Reply Bookmark Topic Watch Topic
  • New Topic

equals() & hashCode() method in Object class  RSS feed

 
shan sundaram
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
What is the use of equals() & hashCode() method? where/how to use it?

Thanks in advance,
V.Shanmugam.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you looked at the JavaDocs for the Object class?
 
Eitan Levi
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In case you're asking because you're interested in overriding them for your own classes, there's a really good article on JavaWorld: How to avoid traps and correctly override methods from java.lang.Object. It shows you how to properly override the equals and hashCode methods.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!