定时器

2019-03-27  本文已影响0人  白纸糊
public class MyTask extends TimerTask {
    private Timer t;
    
    /**
     * @param t
     */
    public MyTask(Timer t) {
        super();
        this.t = t;
    }
    public MyTask() {
        
    }
    static {
        System.out.println("啦啦德玛西亚!");
    }
    
    @Override
    public void run() {
        System.out.println("啦啦德玛西亚!");
//      t.cancel();

    }

}

public class TimerDemo {

    public static void main(String[] args) throws Exception {
//      Timer timer = new Timer();
//      timer.schedule(new MyTask(timer), 3000,1000);
        Class.forName("cn.alittle.Main.Timer.MyTask");
    }

}

上一篇下一篇

猜你喜欢

热点阅读