关于线程的代码问题,求解一下
package xc;
import java.util.*;
public class TextInterrupt {
class MyThread implements Runnable {
public void run(){
while(true){
System.out.println("------"+new Date()+"------");
}
try{
sleep(1000);
}catch(InterruptedException e){
return;
}
}
}
public static void main(String[] args) {
MyThread thread=new MyThread();
Thread t=new Thread(thread);
t.start();
try{
sleep(t.sleep(10000);)
}catch(InterruptedException e){
t.interrupt();
}
}
}