//切记切记:在写入变量前,一定要先指明数据类型;
public class Cycle {
public static void main(String[] args) {
/* 1. while 循环:初始变量;while(判断条件){循环体;最终变量;}
( while循环一种先判断,再循环的模式)*/
//初始变量
int a=0;
//判断条件
while(a<=10){
//循环体
System.out.print("a:"+a);
//最终变量
a++;
}
/* 2. do while循环: 初始变量;do{循环体;最终变量}while(判断条件)
( do-while循环先循环再判断的模式,因此判断条件正确与否至少要运行一次)
*/
int b=0;
do{System.out.println("b:"+b);
b++;
}while(b<=10);
/* 3. for循环:for(初始变量;判断条件;结束变量){循环体}
(for循环相较于while和do-while循环更加简洁)*/
for(int c=0;c<=10;c++){
System.out.println("c:"+c);
}
}
}