hello ! i m a beginner in java. Kindly help me to solve this question.
WatÂ’ll happen when u compile and run this code
public class MySwitch{
public static void main(String argv[]){
MySwitch ms=new MySwitch();
ms.amethod();
}
public void amethod(){
int k=10;
switch(k){
default: // do nothing
System.out.println("this is the default output");
break;
case 10; System.out.println("ten");
case 20: System.out.println("twenty");break;
}
}
}
Options:
1. none of these options
2. Compile time error target of switch must be an integral type
3.Compile and run with output " thid is the default output"
4.Compile and run with output of the single line "ten"