作业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();
    }

}

你可能感兴趣的:(作业16)