System.exit退出程序
2024-09-01 09:28:29
方法源码:
/**
* Terminates the currently running Java Virtual Machine. The
* argument serves as a status code; by convention, a nonzero status
* code indicates abnormal termination.
* <p>
* This method calls the <code>exit</code> method in class
* <code>Runtime</code>. This method never returns normally.
* <p>
* The call <code>System.exit(n)</code> is effectively equivalent to
* the call:
* <blockquote><pre>
* Runtime.getRuntime().exit(n)
* </pre></blockquote>
*
* @param status exit status.
* @throws SecurityException
* if a security manager exists and its <code>checkExit</code>
* method doesn't allow exit with the specified status.
* @see java.lang.Runtime#exit(int)
*/
public static void exit(int status) {
Runtime.getRuntime().exit(status);
}
这个方法将当前运行的Java虚拟结束,非0状态表示非正常退出
说明:
- System.exit(0)是正常退出程序,会将整个虚拟机里的内容都停掉清空
- System.exit(1)或者说非0表示非正常退出程序
最新文章
- git&;sourcetree安装及在IntelliIJ下拉取项目基础使用
- 企业搜索引擎开发之连接器connector(三十)
- javascript event兼容性随笔
- bash 操作 sqlite3
- 【CodeVS】p1174 靶形数独
- hdu1028 Ignatius and the Princess III
- linux Shell的使用
- RabbitMQ介绍2 - AMQP协议
- OC:通讯录实战
- [Everyday Mathematics]20150208
- USB模式安装CentOS6.4_minimal
- msql修改字符
- 关于php-fpm通讯时没有REQUEST_METHOD的问题
- StarTeam SDK 13 下载安装
- ONFI闪存数据通道接口标准
- iPhone页面的常用调试方法
- OC中的类别Category-协议Protocol-…
- H5如何解监听页面退出需求???
- laravel——基础增删改查
- heroku 部署ruby项目后 未连接数据库显示(We&#39;re sorry, but something went wrong. If you are the application owner )