What r daemon/non-daemon threads? In complete reference,it is written that main thread should be the last thread to finish,so use join(),but elsewhere it is written that JVM exits only when all non-daemon threads are dead. I had a program where main thread throws an exception,and the thread it creates finishes quite later,but creates all the expected output.Then condition of complete ref. is not satisfied. I think i have the concepts wrong. Can u help me, thanx in advance, best regards leena
When you dont want the main program to wait for the thread to end you set the code as setDaemon(true). The JVM does not exist until all the non Daemon threads finish executing. Garbage collector is a non Daemon thread.
Joined: Aug 13, 2001
Thanx Vidya >The JVM does not exit until all the non Daemon threads finish >executing. Garbage collector is a non Daemon thread. can u further explain me about garbage collector thread. Does it mean the program jvm will not exit until garbage collector thread completes it's work. Also what is the difference between: jvm exits only when ........ and interpreter exits only when ........... thanx in advance, Best Regards , leena