A for
loop works as follows:
- Initialization is done (
int i=0
in your case; only executed once) - Condition is checked (
i<=100
here), if condition is false leave the loop - Code within the braces is executed (
System.out.println(i);
in your case) - Update statement is executed (
i++
) - Goto 2.