So, Isn't the implementation violating the contract , i.e " If two objects are equal by equals method, their hashCode must be same "?
Back to the original question, when the question statement is like "fullfill the equals() and hashCode() contract", should such kind of implementation that violates the contract be chosen? As this question is from K&B, it has confused me about the contract and implementation.