Well, you can always create code breaking so called general contracts. The book specifies the conditions which have to be fulfilled to satisfy the general contract for java.lang.Object.hashCode() (have a look at the javadocs there). It is necessary to satisfy the general contract to ensure that other classes relying on that contract work properly. For example, hash based collections like java.util.HashSet may not work properly if you break that contract. Do you know why?