1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
/* 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 */ |
Add Comment