for循环和while循环

 1 package com.stx.zx.test;
 2 
 3 public class T03 {
 4     public static void main ( String[] args ) {
 5         int i=0;   //初始化条件
 6         while (i<100){    //条件判断
 7             System.out.println(i);  //循环体
 8             i+=2;  //迭代
 9         }
10         System.out.println("while循环结束");
11 
12 
13         for (int a=0;a<=100;a++){   //初始化;条件判断;迭代
14             System.out.println(a);
15         }
16         System.out.println("for循环结束");
17     }
18 }

 

posted @ 2022-02-28 14:31  VVMgAI  阅读(25)  评论(0)    收藏  举报