A
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;
}
}
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;
}
}
- Correct Answer - Option(A)
- Views: 7
- Filed under category Java
- Hashtags:
Discusssion
Login to discuss.