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

  1. The ordinal
  2. The enum class name
  3. The constant name
  4. null
Correct answer The constant name

Explanation

If not overridden, `toString()` returns the constant's name as a string.

Update: Dhruva Jagannath added a tag on this question

Topics

By Dhruva Jagannath · · 39 views