PRACTICE / UNDERSTAND / REPEAT

Java: Types & equality

Practice types & equality with self-contained questions. Check your answer, then use the explanation to understand the reasoning.

16 questionsAnswers explainedFree · no login
Question 1 of 16
Types & equality · MCQQuestion link ↗

What does `==` compare for two Java object references?

Choose one answer
Answer & explanation

Answer: Whether both references point to the same object

For objects, `==` compares reference identity. Use an appropriate `equals` implementation for value equality.