Java daemon thread
Java uses user thread
and daemon tread
concepts.
JVM flow
1. If there are no `user treads` JVM starts terminating the program2. JVM terminates all `daemon threads` automatically without waiting when they are done3. JVM is shutdown
As you see daemon tread
is a service thread for user treads
.
daemon tread
is low priority thread.- Thread inherits it's properties from parent thread. To set it externally you can use
setDaemon()
method before starting it or check it viaisDaemon()