Daemon threads are threads that run in the background as long as other non-daemon threads of the process are still running. Thus, when all of the non-daemon threads complete, the daemon threads are terminated. An example for the non-daemon thread is the thread running the Main.A thread is made daemon by calling the setDaemon()
method before the thread is started
For More Reference : Daemon thread in Java