D

Dhruva Jagannath • 660 Points
Invincible

Q. What will happen if you use `switch-case` with an enum and forget one constant?

  • (A) Compile-time error
  • (B) Runtime exception
  • (C) Nothing, it will skip unmatched cases
  • (D) The switch will repeat the last matched case

Explanation by: Dhruva Jagannath
If a case is not provided for an enum value, the switch just skips it unless a default case handles it.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.