Question 11
|
What will be the result of executing the following code? public static void main(String args[]) { char digit = 'a'; for (int i = 0; i < 10; i++) { switch (digit) { case 'x' : { int j = 0; System.out.println(j); } default : { int j = 100; System.out.println(j); } } }
int i = j; System.out.println(i); }
|
|
| 100 will be printed 11 times. | 100 will be printed 10 times and then there will be a runtime exception. |
| The code will not compile because the variable i cannot be declared twice within the main() method. | The code will not compile because the variable j cannot be declared twice within the switch statement. |
| None of these. | |
Back to beginning | Next Question |
|
