for循环while循环do、while循环打印1234
public class While{ public static void main(String[] args){ //for打印1-4 for(int a =1;a<5;a++ ){ System.out.println(a); } //while打印1-4 int b=1; while(b<5){ System.out.println(b); b++; } int d =1; while(true){ System.out.println(d); d++; if(d==5){ break; } } //do...while int c =1; do{ System.out.println(c); c++; }while(c<5); } }