Final answer:
The correct answer is option C. The hashCode method should be overridden whenever the equals method is overridden to ensure that two equal objects return the same hash code.
Step-by-step explanation:
The correct answer is option C. When the equals method is overridden, it is recommended to also override the hashCode method to ensure that two equal objects return the same hash code. This is because the equals method checks for equality of objects based on their content, while the hashCode method generates a unique integer value for each object.
Option A is incorrect because not all root class objects in Java have the hashCode method. Option B is also incorrect because invoking the hashCode method multiple times on the same object may return different integers if the object's data are changed. Option D is incorrect because implementing the hashCode method does not guarantee that two unequal objects will never have the same hash code.
Option E is also incorrect because by default, the hashCode method in Java does not return the memory address for the object, but rather a unique integer calculated based on the object's content.