for循环

作者: 哈迪斯Java | 来源:发表于2021-09-11 14:12 被阅读0次

    package Structure;

    public class ForDemon1 {
    public static void main(String[] args) {
    int a =1;//初始条件

        while(a<=100) {//条件判断
            System.out.println(a);//循环体
            a += 2;//迭代
        }
        System.out.println("while循环结束");
    
        for (int i=1;i<=100;i++){
            System.out.println(i);
        }
        System.out.println("for循环结束");
    
    }
    

    }
    //for语句中还可以非常简单的写出,如100.for 代表着for(int i=0;i<100;i++);所谓的快捷键

    相关文章

      网友评论

          本文标题:for循环

          本文链接:https://www.haomeiwen.com/subject/etxbwltx.html