首页 > 其他 > 详细

课后作业

时间:2018-10-21 11:50:47      阅读:123      评论:0      收藏:0      [点我收藏+]
public class Test {
        public static void run() {
            int n=0;
            for(int i=0;i<=10;i++) {
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                Test t=new Test();
                n++;
                System.out.println(n);
            }
    }

    public static void main(String []args) {
        run();
    }

}

用函数run()创建对象,每隔一秒运行一次,使用n计数。

课后作业

原文:https://www.cnblogs.com/kt-xb/p/9824425.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!