package test05; import java.text.SimpleDateFormat; import java.util.Date; public class Demo implements Runnable{ @Override public void run() { // TODO Auto-generated method stub Date date = new Date(); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH:mm:ss"); String s = simpleDateFormat.format(date); System.out.println(s); } public static void main(String[] args) { Demo d = new Demo(); while(true) { Thread t = new Thread(d); try { t.sleep(1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } t.start(); } } }