Java do while循环
do…while 循环类似于while循环,不同之处在于do…while循环保证至少执行一次。
语法
以下是do…while循环的语法:
do { // Statements}while(Boolean_expression);注意布尔表达式出现在循环的末尾,因此循环中的语句在布尔测试之前执行一次。
如果布尔表达式为真,控制将跳回到do语句,循环中的语句再次执行。这个过程重复直到布尔表达式为假。
流程图

示例
public class Test { public static void main(String args[]) { int x = 10; do { System.out.print("value of x : " + x ); x++; System.out.print("\n"); }while( x < 20 ); }}这将会产生以下结果 −
输出
value of x : 10value of x : 11value of x : 12value of x : 13value of x : 14value of x : 15value of x : 16value of x : 17value of x : 18value of x : 19
