what does "do" do here? (java)
Posted
by David
on Stack Overflow
See other posts from Stack Overflow
or by David
Published on 2010-04-17T21:18:04Z
Indexed on
2010/04/17
21:23 UTC
Read the original article
Hit count: 76
I saw this bit of code on the interents somewhere. I'm wondering what thedo
is for.
public class LoopControl {
public static void main(String[] args) {
int count = 0;
do {
if(count % 2 == 0) {
for(int j = 0; j < count; j++) {
System.out.print(j+1);
if(j < count-1)
System.out.print(", ");
}
System.out.println();
}
count++;
} while(count <= 5);
}
}
© Stack Overflow or respective owner