It simply skips odd numbers.
Since the
%
operator gives the reminder of the integer division, for every
even number
ev
,
(ev % 2)
result is
0
. On the other hand, for every
odd number
od
,
(od % 2)
result is
1
.
You know, a more efficient algoritm would be
public static void main(String args[])
{
int i;
for(i = 0; i<=100; i+=2)
{
System.out.println(i);
}
}