Saturday, April 23, 2011

Do - while structure in java

Do-while structures similar to the while loop, only difference is located at
placement condition only. On the structure while the condition is located at the beginning of the block
repetition, sedagkan on the structure of do-while loop is located at the end of the block. Process
repetition will be performed at least once even if it turns out the condition is not fulfilled
(is false).


A common form of writing:
initialization
do {
/ / statement that will be repeated
...
iteration
} while (condition);



example program :


the results of the program will be like this :

No comments:

Post a Comment