Daemon threads stop when the main thread , which executes the main
method, finishes executing and the program terminates.
If a thread < strong> is daemon , the Java process is still active and running, even when it reaches the end of the main
method and the main thread ends.
By default, threads inherit the daemon property from the thread that created them. Because the main thread is daemon , the threads created in the program are not, either.
This makes programs that "do not end" common, especially because few understand this concept or forget to create a mechanism to end threads created during the execution of the main program.