Which of these statements are true?
A) Running user threads prevent JVM from terminating a program. // true
the main thread does not terminate till all user threads have completed their job and return back even though the main method has finished executing.
B) Daemon threads can't be grouped together. // false
Daemon threads can be grouped together. this can be done by creating a thread group and by setting one or more threads under this thread groups isDaemon(boolean t) property to true. A ThreadGroup can have both user threads and Daemon threads.
C) Daemon threads can't be destroyed. \\true
By destroyed i understand stopped.
Java 1.2 has deprecated stop() and the suspend() method. As such a thread cannot be "destroyed". It has to undertake the work it is supposed to do.
However note that A daemen thread ceases to exist once a user thread have completed all their work. Thus the JVM explicitly has to stops the work of the daemon thread when all user threads have completed.
D) Running Daemon threads prevent JVM from terminating a program. //false
With regard to Question 2 I think the answer is correct. Execution of a thread will stop if for example sleep() is called(to be started again later).
Regds.
Rahul