Can anybody explain the workings of the second continue statement below? my understanding is that i == 3, will skip the index position of 4 and move to the next number, 5. - Thank you for your help.
What can be inserted in the following code so that it will print exactly 2345 when compiled and run?
Code: Select all
public class FlowTest {
static int[] data = {1, 2, 3, 4, 5};
public static void main(String[] args) {
for (int i : data) {
if (i < 2) {
//insert code1 here
}
System.out.print(i);
if (i == 3) {
//insert code2 here
}
}
}
}