java倒计时器

package com.changyou;

import java.util.concurrent.*;  
  
public class CountDown {  
    public CountDown(int limitSec) throws InterruptedException{  
        System.out.println("Count from "+limitSec);  
        while(limitSec > 0){  
            System.out.println("remians "+ --limitSec +" s");  
            TimeUnit.SECONDS.sleep(1);  
        }  
        System.out.println("Time is out");  
    }  
      
  public static void main(String[] args) throws InterruptedException { 
        new CountDown(30); 
    } 
  
}  

This moment will nap, you will have a dream; but this moment study, you will interpret a dream.
原文地址:https://www.cnblogs.com/mawenqi-barry/p/7918761.html