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 {
//  ww w. j  av  a  2s.c  o m
  public static void main(String[] args) {
    System.out.println("exit...");
    System.exit(0);
  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.lang »




Boolean
Byte
Character
Class
Double
Enum
Float
Integer
Long
Math
Number
Object
Package
Process
ProcessBuilder
Runnable
Runtime
SecurityManager
Short
StackTraceElement
StrictMath
String
StringBuffer
StringBuilder
System
Thread
ThreadGroup
ThreadLocal
Throwable