🎴 Flashcard Mode
Java Practice Test - 10
Card1 / 25
Mastered0
Review0
QuestionClick to flip
Which two statements are true about properly overridden hashCode() and equals() methods?
- hashCode() doesn't have to be overridden if equals() is.
- equals() doesn't have to be overridden if hashCode() is.
- hashCode() can always return the same value, regardless of the object that invoked it.
- equals() can be true even if it's comparing different objects.
AnswerClick to flip back
A
3 and 4
💡 Explanation:
Statements (3) and (4) are correct.
Statements (1) and (2) are incorrect because hashCode() and equals() can't be overridden.