JAVA中定时任务
-
package temp;
import java.util.Timer;
import java.util.TimerTask;public class GreetingServer {
public static void main(String[] args) {
Timer t=new Timer();
t.schedule(new A(), 5*1000);
}
}class A extends TimerTask{
@Override
public void run() {
System.out.println("123");
}
}