The hashCode() method returns a number that is a kind of identifier for the object, but it isn't necessarily a unique identifier.
Hash-based collection classes (such as HashMap and HashSet) use this to organize the objects that they contain in such a way that they can quickly look objects up.
For example, look at HashSet. You can imagine a HashSet as a collection of buckets. Each bucket can contain one or more objects, and each bucket has a label. Let's make it even more concrete for the example. Suppose you have a HashSet with 10 buckets. When you put an object in the HashSet, it will look at the last digit of the hash code of the object and put the object in that bucket. So, if the hash code ends with 0, it will go into bucket 0; if it ends with 1, in bucket 1, etc. By doing it that way, the HashSet distributes all the objects that you put into over its 10 buckets.
Now, suppose that you want to check if an object is present in the HashSet. You call contains(someObject) on the HashSet. The HashSet now looks at the hash code of someObject, and immediately knows in which of the 10 buckets to look. It can skip the other 9 buckets, which saves a lot of work. It only has to call equals() on the objects that are in one of the buckets.