package NotYet;
public class SoonThough
{
public static void main (String[] args)
{
int[] numbers = { 2, 4, 6, 8, 10} ;
for( int i = 0; i < numbers.length; i++)
{
System.out.println(numbers[i] * 2 );
}
}
}
let's think it through
FIRST TIME INTERING
PRINT numbers[0] * 2 == 4
i becomes 1
1 < 5
PRINT numbers[1] * 2 == 8
i becomes 2
2 < 5
PRINT numbers[2] * 2 == 12
i becomes 3
3 < 5
PRINT numbers[3] * 2 == 16
i becomes 4
4 < 5
PRINT numbers[4] * 2 == 20
i becomes 5
5 < 5 == FALSE
so we do not enter the loop