Timer outTimer=new Timer(); //执行一次 outTimer.schedule(new TimerTask() { @Override public void run() { System.out.println(22222222); } },1000); //执行多次 outTimer.schedule(new TimerTask() { @Override public void run() { } },2000,2000);