while循环语句格式
基本格式:
while(判断条件语句) {
循环体语句;
}
扩展格式:
初始化语句;
while(判断条件语句) {
循环体语句;
控制条件语句;
}
案例:输出10次hello word
public class WhileDemo {
public static void main(String[] args) {
//输出10次HelloWorld
//while循环实现
int x=1;
while(x<=10) {
System.out.println("HellloWorld");
x++;
}
}
}