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.
3 // Origin: Bryce McKinlay <bryce@albatross.co.nz>
5 public class Thread_Alive implements Runnable
7 public static void main(String args[]) throws InterruptedException
9 Thread_Alive ta = new Thread_Alive();
10 Thread t = new Thread(ta);
11 System.out.println(t.isAlive());
13 System.out.println(t.isAlive());
23 System.out.println(t.isAlive());
28 System.out.println("Error: dead thread can be restarted.");
30 catch (IllegalThreadStateException x)
32 System.out.println ("ok");
35 System.out.println(t.getThreadGroup());
38 public synchronized void run()
44 catch (InterruptedException x) {}