Multiple Choice Question

Quiz Guidelines



What will be the result of attempting to compile and run the following code?

class SwitchTest{
public static void main(String args[]){
for ( int i = 0 ; i < 3 ; i++){
boolean flag = false;
switch (i){
flag = true;
if ( flag ) System.out.println( i );

Select 1 option

A. It will print 0, 1 and 2.
B. It will not print anything.
C. Compilation error.
D. Runtime error.
E. None of the above.

Q&A Set: 

Search the Web

Custom Search

Searches whole web. Use the search in the right sidebar to search only within!!!