void testMyScheduleDelayAndPeriod(){
Timer timer = new Timer();
System.out.println("Delay:0秒, Period:1秒");
System.out.println("In testScheduleDelayAndPeriod:" + new Date());
// schedule(TimerTask task, long delay, long period)
timer.schedule(new TimerTask() {
public void run() {
System.out.println("Task~ 執行時間:" + new Date());
}
}, 0, 1000);
}
留言
張貼留言