HTML Java

Java Daemon Thread


Daemon Thread

Daemon Thread is nothing but the thread which runs on background and support for non –daemon thread

Example Garbage collector is running on background suppose Main thread created by jvm and in main we created 1 lakh object after sometime the memory will full then jvm call GarbageCollector thread which clean the unused object or we can say clean the memory and help the main thread to work properly so main thread is non –daemon thread and GC is Daemon thread.

Life of Daemon thread is whenever non –daemon thread is completed then it will also terminated