wood burning stoves 2.0*
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
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "daemon thread?" Watch "daemon thread?" New topic
Author

daemon thread?

srikanth reddy
Ranch Hand

Joined: Jul 28, 2005
Posts: 252
The daemon status of a thread can be changed at any time using the Thread.setDaemon method??

why this is wrong ???is it that the status can be changed only at the begining of the thread???


Thanks & Regards<br /> <br />-Srikanth
Saurabh Chaubey
Ranch Hand

Joined: Oct 16, 2005
Posts: 101
The daemon status of a thread can be changed at any time using the Thread.setDaemon method??

why this is wrong ???is it that the status can be changed only at the begining of the thread???

The reason being that you cannot change the Daemon status of the thread after the start() method gets called otherwise a n IllegalThreadStateException is thrown. You should call the method Thread.setDaemon() before calling the start method on the thread.

I hope you got it.

Regards,
Saurabh
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5126
    
  12

in the K&B book i found nothing about deamon threads, so may i conclude this will not be on the exam?

also for the "you can call a method on a thread object after you invoke start, unless you get IllegalThreadStateException", nothing found in the book, and on school it was burned in like hell


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: daemon thread?
 
Similar Threads
need clarification on threads
Help Please
Thread Question from Dan's mock exam
what are daemon threads?
Daemon