struct-WhileDemo01-03

package com.kuang.struct;
//=====================
//Demo01
//=====================
public class WhileDemo01 {
    public static void main(String[] args) {

        //输出1~100

        int i =0;

        while (i<100){
            i++;
            System.out.println(i);
        }
    }
}
package com.kuang.struct;
//=====================
//Demo02
//=====================
public class WhileDemo02 {
    public static void main(String[] args) {
        while(true){
            //等待客户端连接
            //定时检查
            //......
        }
    }
}
package com.kuang.struct;
//=====================
//Demo03
//=====================
public class WhileDemo03 {
    public static void main(String[] args) {
        int i = 0;
        int sum = 0;

        while(i<100){
            i++;
            sum+=i;
        }

        System.out.println(sum);
    }
}

 

posted @ 2021-09-20 09:55  Ahao丷  阅读(31)  评论(0)    收藏  举报