This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes daemon thread. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "daemon thread." Watch "daemon thread." New topic
Author

daemon thread.

jaman tai
Ranch Hand

Joined: Sep 26, 2005
Posts: 37
With respect to User and Daemon threads:

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

answer: b, e? why e is correct?
Pranav Shukla
Ranch Hand

Joined: Oct 05, 2005
Posts: 64
Daemon threads exist only to serve User threads. Typically they will provide services to the User Threads and User Threads will do the real "work" in the program.

So if there doesn't exist any live User Thread, the JVM may choose to terminate the program even if there are daemon threads running.


Pranav Shukla
SCJP, SCWCD, SCBCD
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
You can find out why e is correct by looking up the definition of a Daemon thread.


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: daemon thread.