What is the output of the following code :
public class Example9 {
public static void main(String[] args) {
System.out.println(check(1));
System.out.println(check(2));
System.out.println(check(3));
System.out.println(check(4));
}
static String check(int a) {
String alas = "?";
if (a < 3)
a--;
switch (a) {
case 1:
return "one";
case 2:
a = 3;
case 3:
break;
case 4:
default:
return alas;
}
return "Result" + a;
}
What is the output of the following code after compilation :
1. ?
2. ? one Result 3
3. ? one Result 3 ?
4. compile error
(3)
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.