12 休眠线程
package ThreadDemo;
// 1. 模拟网络延迟:放大问题发生的情况
// 2. 模拟倒计时
public class Test12_Sleep {
public static void main(String[] args) throws InterruptedException {
tenDown();
}
public static void tenDown() throws InterruptedException {
int n=10;
while (true){
Thread.sleep(1000);
System.out.print(n--+" ");
if (n<=0) break;
}
}
}