public static void exit(int status)
Terminates the currently running Java Virtual Machine.
The argument serves as a status code; by convention, a nonzero status code indicates abnormal termination. This method calls the exit method in class Runtime.
This method never returns normally.
The call System.exit(n) is effectively equivalent to the call:
Runtime.getRuntime().exit(n)
java abc.HelloWorld
ECHO exit=%ERRORLEVEL%
IF ERRORLEVEL 0 ECHO 正常结束,或者调用了System.exit(0)
IF ERRORLEVEL 1 ECHO System.exit(1)
其实两者都不是“正常”退出
try {
System.exit(0); //试试return或者throw
} finally {
System.out.println("!!!!!"); //这行,无论return, throw都会执行,但是System.exit却不是
}