首页 > 代码库 > java定时器

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();
}
}

java定时器