标签:
Timer类与TimerTask类的使用:
public class TimerSchedule { // 定时器 private static Timer timer = new Timer("MyTimer"); public static void main(String[] args) { timer.schedule(new MyTask(), 1000, 1000); } /** * 定时任务 */ private final static class MyTask extends TimerTask { private MyTask() { } public void run() { System.out.println("nihao!"); } } }
标签:
原文地址:http://www.cnblogs.com/DengGao/p/5974830.html