Create Daemon Thread



 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
public class HelloDaemonThread extends Thread{
     
    public HelloDaemonThread(){
        setDaemon(true);
    }
    
    public void run(){
        System.out.println("Is it a Daemon thread ? - "+isDaemon());
    }
    
    public static void main(String a[]){
        HelloDaemonThread dt = new HelloDaemonThread();
        dt.start();
    }
}