Demo16_DoWhile与While的区别
//DoWhile循环结构特性
package com.HuanXin.JiBen_JieGou;
public class Demo08_DoWhile1 {
public static void main(String[] args) {
int A=0;
while (A<0){//-无穷到0,结合int A=0则变成了0-0
A=A+1;
System.out.println(A);
}
System.out.println("=================================");
do {
A=A+1;
System.out.println(A);
}while (A<0);
}
}
/*DoWhile结构具有先执行后判断的能力,在Do大括号内的 A=A+1;
System.out.println(A);可以先被程序执行第一个循环,
再让系统判断是否为真
While结构比较细节,先判断后执行,while大括号内的 A=A+1;
System.out.println(A);就是判断布尔表达式为真还是假*/
浙公网安备 33010602011771号