java while 循环

 

public class Sample {

    public static void main(String[] args) {
        int num = 1;
        while (num <= 10) {
            System.out.print(num + " ");
            num++;
        }
    }
}



OUTPUT:
1 2 3 4 5 6 7 8 9 10

 

posted @ 2019-12-19 09:48  anobscureretreat  阅读(238)  评论(0编辑  收藏  举报