What is daemon thread and how it differs from user thread?

Submitted by: Administrator
A user thread is created by the application (user) while the daemon thread is created by the JVM to provide services to user threads.
If user threads are exists then only daemon threads exists.
You can make a user thread as daemon thread by using setDaemon(true) method.
In an application when only daemon threads are running (i.e. no user thread is running) then JVM will shut down the application and subsequently stops all daemon threads.
To keep the application running, at least one user thread should be running.
Submitted by: Administrator

Read Online Java Multi-Threading Job Interview Questions And Answers