Java基础-while-demo01

package com.jss.struc;

public class WhileDemo01 {
    
    
    public static void main(String[] args) {
    
    
        /**
         *         while是最基本的循环,它的结构为:
         *         while( 布尔表达式 ) {
         *             //循环内容
         *         }
         */
        //循环输出1---100
        int i=0;
        while (i<100){
    
    
            i++;
            System.out.println(i);
        }

        /**
         * while(true){}
         * 这类是死循环,一直在执行中,比如服务器的请求响应监听
         */
    }
}

猜你喜欢

转载自blog.csdn.net/QianXunZhe23/article/details/115259578