Part of the contract of hashcode is that two objects that are equal (ie the equals method return true) have the same hash code.
I your example, if you had two objects with the same idNumber, but different ages, then equals would return true, but they would have different hash codes.
. . . and did they tell you what the error in that equals() method is?
posted 1 month ago
I guess you are aiming at the method parameter of the equals method that takes the object type Lion rather than the object type Object which would turn it from an overloaded equals method to an overridden equals method which is more common