Java Data Type Tutorial - Java System.exit(int status)








Syntax

System.exit(int status) has the following syntax.

public static void exit(int status)

Example

In the following code shows how to use System.exit(int status) method.

public class Main {

  public static void main(String[] args) {
    System.out.println("exit...");
    System.exit(0);
  }
}

The code above generates the following result.