wood burning stoves
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes IBM mock: Daemon and user thread? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "IBM mock: Daemon and user thread?" Watch "IBM mock: Daemon and user thread?" New topic

IBM mock: Daemon and user thread?

Ranch Hand

Joined: Dec 06, 2000
Posts: 35

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

Ankur Gupta
Ranch Hand

Joined: Jun 13, 2000
Posts: 66
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.
I agree. Here's the link: http://aspose.com/file-tools
subject: IBM mock: Daemon and user thread?
It's not a secret anymore!