1.

Explain About Daemon Thread ?

Answer»
  • Daemon threads are the low PRIORITY thread for JVM. Which work as a service provider for the user threads.
  • Daemon threads are BACKGROUND programs, which perform tasks such as garbage collection.
  • Daemon threads cannot prevent JVM from exiting if all user thread has finished their execution.
  • If the program has only daemon thread and it is executing, still it will terminate the thread and will shut down itself.
  • The lifetime of daemon thread totally DEPENDS on user threads.

Methods for daemon thread:

1.public void setDaemon(BOOLEAN status): This method sets the current thread as user thread or daemon thread.

2.Boolean isDaemon(): This method checks whether the current thread is daemon or not. It returns the true or false Boolean value.

Methods for daemon thread:

1.public void setDaemon(boolean status): This method sets the current thread as user thread or daemon thread.

2.Boolean isDaemon(): This method checks whether the current thread is daemon or not. It returns the true or false Boolean value.



Discussion

No Comment Found