Originally posted by Jenny raj: can anyone plz explain thank u.
Normally, when you start a new Thread, the JVM will not terminate while that thread is running. This means you need to monitor it and terminate it yourself when you want to shut the application down.
A daemon thread, by contrast, will not stop the JVM from terminating. They are good for tasks such as regular monitoring of events, or periodic polling of external systems (amongst other uses). Because they don't stop the JVM from terminating, you can treat them as "fire-and-forget" - launch them once at startup and don't worry anymore.
The event-polling thread in a Swing or AWT application is an example of a daemon thread.
(The terminolgy comes from Unix - a daemon process is one that is detached from your normal terminal session)
Excellent overview. Robert put it so much better than the JavaDoc which says something backwards about the JVM can terminate when all threads that are not daemon threads have ended. You have to work out the missing wods that daemon threads will not prevent the JVM from terminating.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi