java定时器

public class threed1 extends Thread {
public void run(){
int i = 2000;
while(true){
try {
threed1.sleep(i);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
i++;
System.out.println("开始计时"+i);
}
}
public static void main(String[] args) {
// TODO Auto-generated method stub
threed1 t1 = new threed1();

t1.start();
}
}

原文地址:https://www.cnblogs.com/baichaofeng123/p/7270165.html