**
倒计时
**
package com.TestThread;
public class TestSleepDemo01 {
public static void tenDown() throws InterruptedException {
int nums = 10;
while (true) {
Thread.sleep(1000);
System.out.println(nums--);
if (nums <= 0) {
break;
}
}
}
//模拟10秒倒计时
public static void main(String[] args) {
try {
tenDown();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}