Exit and halt Java virtual machine

ReturnMethodSummary
voidexit(int status)Terminates the currently running Java virtual machine by initiating its shutdown sequence.
voidhalt(int status)Terminates the currently running Java virtual machine.

public class Main {
  public static void main(String[] args) {
    Runtime runtime = Runtime.getRuntime();

    runtime.exit(2);
  }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.