|
|
A daemon thread is a thread that runs for the benefit of other threads. Daemon threads run in the background and unlike conventional user threads, do not prevent a program from termination. A prime example of a daemon thread is the garbage collector, which is responsible for reclaiming memory from unused object references. Conventional user threads are non-daemon threads. The following example demonstrates the use of deamon threads. Please refer to section 2.3.2 in the Java chapter for more information on threads. Source JAR Files: Please refer to the Java-Basics section for more information on using JAR files. |