Hash code is not in Java. This is important algorithm use everywhere in computing:
In Java, it is important because your class can be uses in some collection based on the algorithms using hash code. Your elements will behave correctly in such algorithms only if you provide some implementation of this function as soon as you define your own equality method. Logically equal objects should manifest equal hash code values, and unequal objects should return values of the hash code which are different with high probability — this is the major requirement for the class implementation.
Sorry, I don't want to explain it once again. Please see my explanation I once provided for .NET:
Object.GetHashCode() Method in C#.Net
In Java, everything is the same, only it has different but similar collection types.
You might be puzzled to know how should you implement hash code for your classes when it is required. I'll give you a very simple recipe. Consider your class has several fields which are use in
implementation. Supposing they already have implementation of hash code, take all their hash code values and make a binary XOR of all of them. Return the resulting value as a hash code of the composing object. That's it.
For a home exercise, think why this implementation works. :-)