作业16

package Example12_12;
import java.util.Date;
class ThreadTime implements Runnable{
    Date date = null;
    public void run() {
        while(true) {
        date = new Date();
        System.out.println(date);
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        }        
    }
} 
public class Test12_19 {
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Thread time = new Thread(new ThreadTime());
        time.start();
    }

}

posted on 2019-12-22 22:36  张九川  阅读(189)  评论(0编辑  收藏  举报

导航