Java多线程基础之任务调度

mac2022-06-30  75

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

 

  

 

转载于:https://www.cnblogs.com/yjxs/p/9849113.html

相关资源:定时器与多线程任务调度器使用
最新回复(0)