1)JVM exits when uncaught exception is thrown in daemon thread. 2)Thread th = new Thread(); th.start() causes the thread to start running and eventually complete its execution. The object reference by th is not accessable any more and is garbage collected when the garbage collecter runs. is true. Are the above statements true?
[This message has been edited by avn (edited August 20, 2000).]
The first statement is definitely false. The daemon threads serve to provide a service in the background. They live as long as the program lives (at least one non-daemon thread). But their death do not influence the running program. So, any unchecked exceptions thrown by daemon threads will never quit the JVM. The second statement is false too. According to "Thinking in Java" by Bruce Eckel: "Each Thread �registers� itself so there is actually a reference to it someplace and the garbage collector can�t clean it up."
It's hard to fight evil. The little things, like a nice sandwich, really helps. Right tiny ad?