1 // Test the status of the isAlive() flag before, during, and after thread
2 // execution. Check that thread's threadgroup is null after thread exits.
4 public class Thread_Alive
implements Runnable
6 public static void main(String args
[]) throws InterruptedException
8 Thread_Alive ta
= new Thread_Alive();
9 Thread t
= new Thread(ta
);
10 System
.out
.println(t
.isAlive());
12 System
.out
.println(t
.isAlive());
22 System
.out
.println(t
.isAlive());
27 System
.out
.println("Error: dead thread can be restarted.");
29 catch (IllegalThreadStateException x
)
31 System
.out
.println ("ok");
34 System
.out
.println(t
.getThreadGroup());
37 public synchronized void run()
43 catch (InterruptedException x
) {}