Saturday, January 12, 2013

MainMethodDaemonThreadExample


package com.basics;

public class MainMethodExample {
/*
 The thread by default is NON Daemon*/
public static void main(String args[]) {
System.out.println("Is this a daemon thread........"+Thread.currentThread().isDaemon());
Thread.currentThread().setDaemon(true);
System.exit(0);
// Runtime.getRuntime().exit(0);
System.out.println("After system exit............"+Thread.currentThread().isAlive());
}
 
}

No comments:

Post a Comment