您的位置:首页 > 其它

timer,TimerTask的使用

2008-08-28 11:18 337 查看
timer,TimerTask结合使用来完成定时任务,需要注意的是只要一个timer任务被意外中止,则整个任务被中止。可以采用线程代替这种应用。

public class timerapp
        extends TimerTask
{

 

timerapp(){

}

 

public void run(){

 

}

}

 

Timer sss = new Timer();

sss.schedule(new timerapp,100,10000);

 

syntax:

void schedule(TimerTask task, long delay, long period)
          Schedules the specified task for repeated fixed-delay execution, beginning after the specified delay.

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  timer 任务