Saturday, January 12, 2013

NonDaemonThreadExample


package com.basics;
/*
 *
 * Runtime.getRuntime.exit() and System.exit() method to terminate the CURRENTLY RUNNING JVM
 */

public class NonDaemonThreadExample {

public static void main(String args[]) {
System.out.println("I this a daemon thread........"+Thread.currentThread().isDaemon());
// Thread.currentThread().setDaemon(true);
System.exit(1);
// Runtime.getRuntime().exit(0);
System.out.println("After system exit............"+Thread.currentThread().isAlive());
}
}

No comments:

Post a Comment