10秒后 进行操作(Timer)

来源:互联网 发布:淘宝销量下滑原因分析 编辑:程序博客网 时间:2024/06/05 11:52

Timer time = new Timer();

time.schedule(new tast(), 10000); // 10秒后执行 .去除为立即执行


//tast() 方法

class tast extends TimerTask {
        public void run() {
            
            try {
                 //做你的操作

            } catch (Exception e) {
                e.printStackTrace();
            }
            
        }
    }
原创粉丝点击