标签:format rri static extend public timer str task com
package com.funo.timer;
import java.util.Timer;
public class MyTimer {
public static void main(String[] args) {
Timer timer =new Timer();
timer.schedule(new MyTimerTask(),2000,3000);
}
}
//----------------------------------------------------------------
package com.funo.timer;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimerTask;
public class MyTimerTask extends TimerTask {
@Override
public void run() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println("doing timer task"+sdf.format(new Date()));
}
}
标签:format rri static extend public timer str task com
原文地址:http://www.cnblogs.com/guolsblog/p/6103057.html