TimerTask task = new TimerTask() {
public void run() {
// 定时器运行的代码
};//这里有分号一定要注意
Timer timer = new Timer();
long delay = 0;
long intevalPeriod = 1 * 1000;
timer.scheduleAtFixedRate(task, delay, intevalPeriod);
public void run() {
// 定时器运行的代码
};//这里有分号一定要注意
Timer timer = new Timer();
long delay = 0;
long intevalPeriod = 1 * 1000;
timer.scheduleAtFixedRate(task, delay, intevalPeriod);