Wednesday, December 1, 2010

Java Tutorial #13

0
Do-While Loop in Java
It will first execute a body of codes before testing for a condition.  Its general equation is:

do{
statements;
}while(condition);

Where:
condition = is where the loop will stop.

You maybe find this very similar to the while loop (because I use the same problem) but as we move on you will see their differences.  But for now, the obvious difference is that the while loop will test first for a condition then execute a command while do-while will execute a command first before testing for a condition.  Consider this example.



No Response to "Java Tutorial #13"

Post a Comment