lass MyThread extends Thread{
public void run(){
try {
Thread.currentThread().sleep(3000);
} catch (InterruptedException e) {
}
System.out.println(Thread.currentThread().getName());
}
}
public class ThreadTest{
public static void main(String args[]) {
MyThread t = new MyThread();
t.run();
t.start();
System.out.println("Thread Test");
}
} |
|