sabato 30 marzo 2013

Q97


what should keyword1 and keyword2 be respectively, in oreder to produce output 2345?

int [] array = {1,2,3,4,5};

for (int i: array) {

if ( i < 2) {

keyword1 ;

}

System.out.println(i);

if ( i == 3) {

keyword2 ;

}

}

A.
continue, break

B.
break, break

C.
break, continue

D.
continue, continue

Risposta D :

             int[] array = { 1, 2, 3, 4, 5 };

             for (int i : array) {

                    if (i < 2) {

                          continue;// keyword1 ;

                    }

                    System.out.println(i);

                    if (i == 3) {

                          continue;// keyword2 ;

                    }

             } //2345

Nessun commento:

Posta un commento