do...while循环:
一、do..while循环的语法结构:
do{
循环体;
}while(布尔表达式);
二、do...while循环的行动原理
三、do...while循环的执行次数:
do...while循环的循环体代码片段执行次数是:1~N次【至少一次】
四、使用do...while循环语句最终有一个“分号”别丢了。
五、代码
public class WhileTest02 {
public static void main(String[] args) {
int i = 1;
while (i <= 10) {
System.out.println(i);
i++;
}
System.out.println("end -->" + i);
System.out.println("-----------------------------------------------------------");
int j = 10;
while (j > 0) {
System.out.println(j--);//10 9 8 7 6 5 4 3 2 1
System.out.println("end j --> " + j);//9 8 7 6 5 4 3 2 1
}
System.out.println("end -->" + j);//0
System.out.println("-----------------------------------------------------------");
int k = 10;
while (k >= 0) {
System.out.println(--k);//9 8 7 6 5 4 3 2 1 0 -1
}
System.out.println("end k --> " + k);
}
}
六、资料来源
【Java零基础教程视频(适合Java 0基础,Java初学入门)】 https://www.bilibili.com/video/BV1Rx411876f/?p=77&share_source=copy_web&vd_source=9bce191eb50f06ae83cb422d8b7f8f31