How to create a deamon thread?
A daemon thread is simply a background thread that is subordinate to the thread that creates it, so when the thread that created the daemon thread ends, the daemon thread dies with it. A thread that is not a daemon thread is called a user thread. To create a daemon thread, call
setDaemon() method with a
true boolean value as argument before the thread is started.