public class Countdown {
private int lin;
public Countdown(int lin)throws InterruptedException{
this.lin = lin;
System.out.println("最后倒数时刻:" + lin + "秒" + " ");
while (lin > 0){
System.out.println("倒计时: "+ --lin +"秒");
TimeUnit.SECONDS.sleep(1);
}
System.out.println("Game over!!!");
}
public static void main(String[] args) throws InterruptedException{
new Countdown(30);
}
}