Daemon Threads in Java

A daemon thread is a background thread and dies when the thread that created it ends.

A thread that is not daemon is called a user thread.

We can make a thread as daemon thread by calling setDaemon (true) on the thread instance.

We can call setDaemon() for a thread only before it starts, else an IllegalThreadStateException will be thrown.



MyThread t1= new MyThread ();




Note: A complete working example will be added soon.

Search the Web

Custom Search

Searches whole web. Use the search in the right sidebar to search only within javajee.com!!!