本帖最后由 黑马张伟 于 2011-12-26 07:42 编辑
ScheduledExecutorService timer=Executors.newScheduledThreadPool(1);
timer.scheduleAtFixedRate(
new Runnable(){
public void run() {System.out.println("来啊!");
currentLamp=currentLamp.blackOut();
}
},
10,
10,
TimeUnit.SECONDS);
两个10和TimeUnit.SECONDS的意思 |