struct-WhileDemo01-03

时间:2022-05-27 20:10:35   收藏:0   阅读:15
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);
    }
}

 

原文:https://www.cnblogs.com/iamaghao/p/15313694.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!