These are completely different concepts.
Cat oldCat = new Cat(); Cat newCat = new Cat(); Cat oldCatRef = oldCat;
In the above example, oldCat and oldCatRef are references to the same object. Since they refer to the same object, their hash codes will be equal.
But oldCat and newCat do not refer to the same object. These are links to two different objects. But they can have the same hashCode based on their implementation. hashCode is just a method in the Object class that you can override.
EDIT (from PeterJ): According to the specification of the JavaSE6 object, if oldCat.equals (newCat), then the hash code of the two should be equal. This is good programming to obey this contract.
You probably also want to check the answers to this question:
difference between hash code and object link or address?
source share