Following is a question:-
_______________________Begin snip_____________________________________
If the following code is successfully compiled and run without explicitly enabling assertions, what will happen?
class Language{
public static final int java=1;
public static final int pascal=2;
public static final int csharp=3;
}
public class Mgos {
static int lang=0;
public static void main(
String argv[]){
switch(lang){
case Language.java:
System.out.println("java");
break;
case Language.pascal:
System.out.println("pascal");
break;
case Language.csharp:
System.out.println("csharp");
break;
default:
assert false : lang;
}
}
}
1) An unmatched parameter exception will be thrown
2) An assert exception will be thrown
3) The program will run with no output
4) Output of "csharp"
___________end snip_________________________________________
what should be the answer and why ?
Thanks