Daemmon threads are just service providers to other User threads.A daemon
thread is stopped if there are no other user threads are running.When an application starts,a user thread is automatically executed to run the main() method & other threads are spawned from this main thread.
In your code the other thread that is created is a daemon thread & hence once the main thread finishes the execution ,program terminates.