public class test {

 /**
  * @param args
  */
 public static void main(String[] args) {
  final Timer timer=new Timer(); 
  final int t=0;
   timer.schedule(new TimerTask(){
    int pointer=5;
    public void run(){
     pointer--;
     System.out.println("系统将在"+pointer+"秒后重启!");    
     if(pointer==0){
      timer.cancel();
     }
    }   
   },1000,1000);

 }

}

posted on 2009-02-18 17:03  tsliudong  阅读(144)  评论(0)    收藏  举报