what is doman thread and non doman thread?
Daemon Thread: It won't prevent program from ending. That means if the wants to stop and then Daemon Thread won't stop it from ending.
Daemon threads exist only to do some work for non-daemon threads. If the only threads left in the JVM are daemon, then your program exits (terminates). If you make a thread daemon, it exits immediately after the only non-daemon thread (the main thread) finishes - i.e. the daemon thread has not time to count from 10 to 1. But if you make thread non-daemon, it finishes its job to the end (counting from 10 to 1).