LearnFrenzy
Sign in Take a free test

Classes and Objects · Classes and Objects MCQ · Question 8

Default equals() for objects Answer, explanation & discussion

  • MCQ
  • Medium
  • 0 comments
  • Answer explained
  • Moderated community
Question 8 Back to Exercise

If a class does not override equals, what does a.equals(b) compare?

  • A All fields
  • B The references – same as a == b Correct
  • C The hash codes
  • D The toString results
Correct Answer: Option B

Object.equals is identity comparison.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links