package com.happy.timer; import java.util.Date; import java.util.Timer; import java.util.TimerTask; public class TimerDo { public static void main(String[] args) { Integer cacheTime = 1000 * 3; Timer timer = new Timer(); // (TimerTask task, long delay, long period)任务,延迟时间,多久执行 timer.schedule(new TimerTask() { @Override public void run() { System.out.println(new Date()); } }, 1000, cacheTime); } }
Java定时器设定一个任务循环去执行
阅读:3213 输入:2014-07-07 00:54:26
- 上一篇:基于人脸识别的课堂点名系统(设想)
- 下一篇:只限输入中文的js代码