D

Dhruva Jagannath • 660 Points
Invincible

Q. What is the default return value of the `toString()` method in enums if not overridden?

  • (A) The ordinal
  • (B) The enum class name
  • (C) The constant name
  • (D) null
  • Correct Answer - Option(C)
  • Views: 12
  • Filed under category Java
  • Hashtags: Java Enums

Explanation by: Dhruva Jagannath
If not overridden, `toString()` returns the constant's name as a string.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.