What happens when you try to subclass an enum?

  1. It compiles but fails at runtime
  2. It compiles and runs
  3. Compile-time error
  4. It throws an exception
Correct answer Compile-time error

Explanation

You cannot subclass an enum, and trying to do so results in a compile-time error.

Update: Dhruva Jagannath added a tag on this question

Topics

By Dhruva Jagannath · · 33 views