1、概述
- Java提供了4种循环语句,分别是:while循环、do while循环、for循环。
2、while循环使用格式
while(循环继续的条件表达式){
循环体或称循环内容
}
3、while循环的执行流程

4、while循环使用场景
// 上课迟到,罚做俯卧撑20次
int i = 1;
while(i<=20){
System.out.println("上课迟到,罚做俯卧撑"+i+"次");
i++;
}
while(循环继续的条件表达式){
循环体或称循环内容
}
// 上课迟到,罚做俯卧撑20次
int i = 1;
while(i<=20){
System.out.println("上课迟到,罚做俯卧撑"+i+"次");
i++;
}
本文标题:二十二:Java基础入门-Java循环结构语句的特点和使用方法
本文链接:https://www.haomeiwen.com/subject/keynkctx.html
网友评论