Home / Programming MCQs / JAVA MCQs / Question

R

Ram Sharma • 174.83K 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

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.