定时器

import  java.util.Timer;
import  java.util.TimerTask;
import  java.util.Date;
public  class  jzw
{
public  static   void  main(String[]  args)
{
new Timer().schedule(new  TimerTask(){
@Override
public  void  run()
{
System.out.println("Bombing!");
}
}
,10000,3000);
//过3秒炸一下
//10秒炸一下
/*
while(true)
{
System.out.println(new  Date().getSeconds());
try{
Thread.sleep(1000);
}catch(InterruptedException e)
{
e.printStackTrace();
}
}
*/
}

}

posted on 2012-01-24 13:21  平安夜  阅读(195)  评论(0编辑  收藏  举报