D

Dhruva Jagannath • 660 Points
Invincible

Q. What does the `ordinal()` method of an enum return?

  • (A) The name of the constant
  • (B) The position of the constant in the enum declaration
  • (C) The hashcode of the constant
  • (D) The string value of the enum

Explanation by: Dhruva Jagannath
`ordinal()` returns the position (zero-based index) of the enum constant in its declaration.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.