编写一个计数器,每隔1秒钟,在控制台打印出最新时间
import java.util.*;
public class Test01{
public static void main(String [] args){
while(true){
SimpleDateFormat sd=new SimpleDateFormat("HH:mm:ss");
System.out.println(sd.format(new Date()));
try{
Thread.sleep(1000);
}catch(InterruptedException e){
e.printStackTrace();
}
}
}
}