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);
	}
}

  

猜你喜欢

转载自www.cnblogs.com/yjxs/p/9849113.html