By default when a thread is created in
java it is a user thread. A thread can be made daemon by using setDaemon().Daemon threads work in background. JVM diffrentiates b/w these threads as follows : When user thread exits JVM checks whether there are more user threads to execute. If none present then JVM exits. It means that when only daemon threads are running JVM shuts down. An example of daemon thread is garbage collection. Daemon threads should be used for background processes..