package com.huxin.io.replenish;
/*
* 如何让时间的秒钟一直在跳?
*/
import java.util.Date;
public class DateTest {
public static void main(String[] args) {
new Thread(new Time()).start();
}
}
class Time implements Runnable{
String s = null;
public void run() {
while(true){
Date d = new Date();
s = d.toString().substring(11, 19);
System.out.println(s);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}