There is a test task with not the only answer:
What are the contract rules between hashCode () and equals ()?
1) If two objects return different hashcode () values, they cannot be equal
2) If two objects return the same hashCode () values, then they are equal
3) If two objects are not equal, then their hashCode () is necessarily different
4) If two objects are equal, then they should return the same hashCode () value
Do I understand correctly that, in accordance with the rules of the contract, only answer 4 is correct?
* If objects are equal according to the results of the equals method, then their hashcode should be the same.
** If objects are not equal according to the results of the equals method, then their hashcode can be either the same or different. However, for better performance, it is better that different objects return different codes.