While do while循环,for循环

While 循环

While do while循环,for循环

public class WhileDome01 {
    public static void main(String[] args) {
//        int a = 101;
//        int b = 50;
//        int c = 2;
//        System.out.println(101*50);
        // 计算 1+2+_+100 = ?
        int i = 0;
        int sum = 0;
        while(i<=100){
            sum += i++;

        }
        System.out.println(sum);
    }
}

Do while循环

While do while循环,for循环

public class DowhileDemo02 {
    public static void main(String[] args) {
        int i = 0;
        int sum = 0;
        while (i<0){
            System.out.println(i);
        }
        System.out.println("==============");
        do {
            System.out.println(i);
        }while (i<0);
    }
}

for 循环

While do while循环,for循环

上一篇:C#多线程图片爬虫


下一篇:转-spring-boot 注解配置mybatis+druid(新手上路)-http://blog.csdn.net/sinat_36203615/article/details/53759935