File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes hashcode Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "hashcode" Watch "hashcode" New topic


Surya Bavirti

Joined: Sep 08, 2008
Posts: 13
obj1,obj2 are from same 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
Ranch Hand

Joined: May 31, 2007
Posts: 3371
No, the contract is that if two objects are equal then they must return the same hashCode but the reverse is not always true.

[] | [Java job hunting know how] | [Java resumes]
I agree. Here's the link:
subject: hashcode
It's not a secret anymore!