zcy舊號(hào)
2016-09-01 20:47:31
public class MyWait extends Thread { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS"); public void run() { synchronized (this) { while (true) { System.out.println(sdf.format(new Date())); try { this.wait(1000); } catch (InterruptedException e) { e.printStackTrace(); } } } } public static void main(String[] args) { new MyWait().start(); new MyWait().start(); }}
添加回答
舉報(bào)
0/150
提交
取消