What does 'active'
thread mean in
Java ???
In the program below, main thread dies before the child thread, but it still remains active. Can anyone explain this ?
class MyThread implements Runnable {
static Thread main;
public void run() {
try {
for(int i = 0; i < 1000; i ++ ) {
Thread.sleep(5);
}
} catch(Exception e) {}
System.out.println("Main Thead is running :" + main.isAlive());
System.out.println("Active Threads in Thread Group :" + Thread.currentThread().getThreadGroup().getName() + " " + Thread.activeCount());
}
public static void main(
String[] args) {
main = Thread.currentThread();
Thread t = new Thread(new MyThread());
t.start();
System.out.println("Active Threads in Thread Group :" + t.getThreadGroup().getName() + " " + Thread.activeCount());
}
}