Java计时器Timer和TimerTask用法

 package com.sy.game.test;

 import java.util.Timer;
import java.util.TimerTask; public class TimeTask { public static void main(String[] args) {
TimeTask tTask=new TimeTask();
tTask.timeVoid();
} public void timeVoid(){
final Timer timer = new Timer();
TimerTask tt=new TimerTask() {
@Override
public void run() {
System.out.println("到点啦!");
timer.cancel();
}
};
timer.schedule(tt, 3000);
}
}
上一篇:Zabbix监控告警Lack of free swap space on Zabbix server解决办法


下一篇:IOS 数据库