/*
Terminate virtual machine using System class
This example shows how to get currently running virtual machine
by using exit method of Java System class.
*/
public class TerminateVM {
public static void main(String[] args) {
/*
* To terminate virtual machine use
* public static void exit(int intStatus) method of
* System class.
*
* Here, as per convention non zero status code should
* be specified for any abnormal conditions.
*/
System.out.println("Exiting current virtual machine");
System.exit(0);
System.out.println("This will not be printed");
}
}
/*
Typical output would be
Exiting current virtual machine
*/
Bookmark/Search this post with:
Post new comment