D

Dhruva Jagannath • 660 Points
Invincible

Q. What will this code print?

Code:
enum Level { LOW, MEDIUM, HIGH }
System.out.println(Level.HIGH.ordinal());
  • (A) 1
  • (B) 2
  • (C) HIGH
  • (D) 0

Explanation by: Dhruva Jagannath
`HIGH` is the third constant in the enum, so its ordinal is 2.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.