标签:java for ar new ef text print public
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;
class MyTask extends TimerTask {
public void run() {
SimpleDateFormat sdf = null;
sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
System.out.println("The system time now is: " + sdf.format(new Date()));
}
}
public class TestTask {
public static void main(String[] args) {
Timer t = new Timer();
MyTask myTask = new MyTask();
t.schedule(myTask, 1000, 2000);
}
}
Timer和TimerTask,布布扣,bubuko.com
标签:java for ar new ef text print public
原文地址:http://www.cnblogs.com/vonk/p/3913059.html