LearnFrenzy
Sign in Take a free test

Classes and Objects · Classes and Objects MCQ · Question 10

The default toString() Answer, explanation & discussion

  • MCQ
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
Question 10 Back to Exercise

What does System.out.println(obj) print for a class that does not override toString?

  • A All field values
  • B The class name, @ and a hexadecimal hash code Correct
  • C Nothing
  • D Compile error
Correct Answer: Option B

For example Product@1b6d3586.

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