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

hashcode

 
Surya Bavirti
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
obj1,obj2 are from same class.is the hashcode() of obj1,obj2 are equal?.Suppose if two objects of same class having equal hashcode,does it mean that the two objects are equal?
 
arulk pillai
Author
Ranch Hand
Posts: 3387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, the contract is that if two objects are equal then they must return the same hashCode but the reverse is not always true.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic