A

Admin • 825.56K Points
Coach

Q. What is the output of the below Java program with SWICH and ENUM?

Code:
static enum ANIMAL {GOAT, TIGER, CAMEL}
public static void main(String args[])
{
ANIMAL ani = ANIMAL.CAMEL;
switch(ani)
{
case GOAT: System.out.println("GOAT");break;
case CAMEL: System.out.println("CAMEL");break;
case TIGER: System.out.println("TIGER");break;
}

}
  • (A) CAMEL
  • (B) GOAT
  • (C) TIGER
  • (D) Compiler error
  • Correct Answer - Option(A)
  • Views: 7
  • Filed under category Java
  • Hashtags:

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.