日期:2014-05-17 浏览次数:20975 次
package com.zf.test;
import java.util.Timer;
import java.util.TimerTask;
public class Test7 {
public void delete(){
System.out.println("delete...");
}
public void start(){
new Timer().schedule(new TimerTask() {
public void run() {
delete();
}
}, 0 , 60000 * 24);
}
public static void main(String[] args) {
new Test7().start();
}
}
------解决方案--------------------
1.timer&timerTask
2.ScheduledExecutorService
------解决方案--------------------
spring中有定时器功能,而且very easy