Java Reference
In-Depth Information
< Day Day Up >
Puzzle 26: In the Loop
The following program counts the number of iterations of a loop and prints the count when the loop
terminates. What does it print?
public class InTheLoop {
public static final int END = Integer.MAX_VALUE;
public static final int START = END - 100;
public static void main(String[] args) {
int count = 0;
for (int i = START; i <= END; i++)
count++;
System.out.println(count);
}
}
 
 
Search WWH ::




Custom Search