1.What is the output of the Java program below?
String animal = "GOAT";
switch(animal)
{
break: System.out.println("DOMESTIC");
}
Ans. Compile error.
2. What is the output of Java program with SWITCH?
int num=20;
switch(num)
{
case 10: System.out.println("TEN"); break;
case 20: System.out.println("TWENTY"); break;
case 30: System.out.println("THIRTY");
}
Ans. TWENTY
