Shervin Asgari Shervin Asgari - 1 year ago 77
Java Question

do while syntax for java

Ages since I have written a do while.

Whats wrong with this do while

int i = 0;
do {
} while(++i == 500);

I only goes once through the loop, and IMO it should iterate 500 times.

Answer Source

You probably meant

while (++i < 500);

instead of

while (++i == 500);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download