Expect to come across this popular question in Java thread interview questions.   A daemon thread is a thread that does not stop the JVM from exiting. When all non-daemon threads are finished, the JVM simply abandons any remaining daemon threads. Daemon threads are usually used to perform support or service operations for other threads, but you should note that they can be removed at any time.  If you want to start a thread as a daemon,  use the setDaemon() method before the start() call.  Thread d = new Thread(() -> System.out.println("Hello from daemon!"));
d.setDaemon(true);
d.start();  Strangely, the message may not be printed if you run it as part of the main() method. This can happen if the main() thread terminates before the daemon has time to print the message. In general, you shouldn't do I/O on daemon threads because they can't even fill their last blocks or close resources if they're abandoned.