Loops do ... while
do ... while loop format:
Implementation process
- The order of execution: ①③④> ②③④> ②③④ ... ② so far satisfied.
- ① responsible for completing the loop variable initialization.
- ② responsible for determining whether the loop condition is not satisfied out of the loop.
- ③ execution of specific statements
- ④ After the loop, the loop variable changes
Execution Flow
demand
Code illustrates basic use of do..while
Code
/ * Standard format do-while loop: do { loop } while (conditional); Extended format: initialization statements do { loop stepper statement } while (conditional); * / public class Demo11DoWhile { public static void main (String [] args) { int I =. 1; // 1. initialization statements do { System.out.println ( "refueling" + I); // 3. loop I ++; // 4. stepper statement } the while (I <=. 3); // 2. conditional } }
Results of the