当代码中存在System.exit()之类的代码时,会关闭当前应用程序。
exit
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)
Parameters:
status - exit status.
Throws:
SecurityException - if
a security manager exists and its checkExit method
doesn 't allow exit with the specified status.
See
Also:
Runtime.exit(int)
本文详细介绍了Java中的System.exit()方法,解释了如何使用该方法来终止正在运行的Java虚拟机。文章指出了传递给此方法的参数作为退出状态码的作用,并强调了非零状态码通常表示异常终止的情况。
1293

被折叠的 条评论
为什么被折叠?



