This is a multiple choice question, the only answers I am pretty positive are B and E, but what about other choice like A and D. I don't have a clue whether they are correct. Plz shed some lights on, Java experts. With respect to User and Daemon threads, which are true?
a) Daemon threads can not be destroyed
b) Running User threads prevent a JVM from terminating program
c) Running Daemon threads prevent a Java VM from terminating program
d) Daemon threads can not be grouped together
e) The JVM can terminate program when only daemon threads are running
posted 15 years ago
Jason, For "A" : The destroy method for "Thread" is not implemented (It is implemented for ThreadGroups but, even in that, all the threads should have stopped executing, only then you can use the destroy method otherwise an IllegalThreadStateException is thrown). So for Thread one needs to implement the destroy method oneself. Within that, u could code a System.exit() method to have a premature exit. For "D" - A ThreadGroup can be set to become a Daemon ThreadGroup by the setDaemon() method of the ThreadGroup. But the option there(in ur Question) is to group daemon threads together. It is the other way round. It is not all that clear I know. But, I have tried with what I knew and what I could fish out. Hope it has been of some help. Ankur