Java多线程基础之任务调度

* Timer:任务调度
 * schedule(TimerTask task, Date time);
 * schedule(TimerTask task, Date
 * firstTime, long period);
 * TimerTask实现了Runnable接口;也是一个线程 可以了解一下QUQRTZ框架

 

public class Time {
	public static void main(String[] args) {
		Timer timer = new Timer();

		timer.schedule(new TimerTask() {

			@Override
			public void run() {
				System.out.println(" so easy");

			}
		}, new Date(System.currentTimeMillis() + 1000), 1000);
	}
}

 

  

 

posted on 2018-10-25 12:41  yijiaxiong  阅读(564)  评论(0编辑  收藏  举报