public static void main(String[] args) thr睿共享 ows InterruptedException { //sleep打印系统时间 while(true){睿共享 //打印当前时间 Date date = new Date(System.currentTimeMillis());//获取系统当前时间 Thread.sleep(1000); System.out.println(new SimpleDateFormat("HH睿共享 :mm:ss").format(date)); date = new Date(System.currentTime睿共享 Millis()); } }
//模拟倒计时
public static void tenDown2() throws InterruptedException {
int num=10;
while (true){
Thread.sleep(1000);
System.out.println(num--);
if (num<0){
break;
睿共享 }
}
}