System.exit()方法的作用
/**
* 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);
}
相比有不同的是:return是回到上一层,而System.exit(status)是回到最上层。
System.exit()方法的作用的更多相关文章
- android中finish和system.exit方法退出的区别
finish只是将此activity推向后台,并没有释放资源. 而system.exit则是杀死进程,会释放资源
- System.exit(0)作用
System.exit(0)作用 public class HelloGoodbye{ try{ System.out.println(“Hello World”); System.exit(0) ...
- main函数中System.exit()的作用
main()主函数再熟悉不过,了解java的人也都知道System.exit()方法是停止虚拟机运行.那这里为什么还要单独写一篇博客,都是源于朋友发的一张最近刚买的T恤照片,就是上面这张图.这是一个经 ...
- 对于System.exit(0)和System.exit(1)的一般理解
public static void exit(int status) 终止当前正在运行的 Java 虚拟机.参数用作状态码:根据惯例,非 0 的状态码表示异常终止. 该方法调用 Runtime 类中 ...
- Java 中的System.exit
在java 中退出程序,经常会使用System.exit(1) 或 System.exit(0). 查看System.exit()方法的源码,如下 /** * Terminates the curre ...
- android中 System.exit(0)的理解
public class HelloGoodbye{ try{ System.out.println(“Hello World”); System.exit(0); } finally { Syste ...
- Java: System.exit() 与安全策略
说明 System.exit() 的本质是通知 JVM 关闭. 一般来说,有两种禁用 System.exit() 的办法: 安全管理器 安全策略 本质都是JRE 提供的本地实现,在执行之前进行权限判断 ...
- System.exit(-1)和return 的区别
对于只有一个单一方法的类或者系统来说是一样的,但是对于含有多个类和方法,且调用关系比较复杂时就不一样了. System.exit(-1)是指所有程序(方法,类等)停止,系统停止运行. return只是 ...
- android Activity类中的finish()、onDestory()和System.exit(0) 三者的区别
android Activity类中的finish().onDestory()和System.exit(0) 三者的区别 Activity.finish() Call this when your a ...
随机推荐
- js函数——倒计时模块+无缝滚动
倒计时 效果: 代码: <!DOCTYPE html> <html lang="en"> <head> <meta charset=&qu ...
- POJ 1064 Cable master
Cable master Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 37865 Accepted: 8051 Des ...
- [Everyday Mathematics]20150205
设 $\phi:[k_0,\infty)\to[0,\infty)$ 是有界递减函数, 并且 $$\bex \phi(k)\leq \sex{\frac{A}{h-k}}^\al\phi(h)^\be ...
- Tombstone crash
首先,android平台应用程序可能产生以下四种crash:App层:Force close crashANR crashNative层:Tombstone crashKernel层:Kernel p ...
- Ye.云狐J2刷机笔记 | 完美切换内部存储卡和SD卡的改法.vold.fstab
================================================================================Ye.完美切换内部存储卡和SD卡成功.v ...
- linux下mysql数据库的学习
转载博客:http://freedomljtt.blog.163.com/blog/static/72294949201210145441701/ ubuntu12.04 卸载和安装mysql 卸载m ...
- CATALOGUE 目录
1 语言基础 1.1 c/c++ [转]C/C++ 存储类型 作用域 连接类型 [转]C/C++内存划分 [转]C/C++除法实现方式及负数取模详解 [转]为什么C++编译器不能支持对模板的分离式编译 ...
- 圆内,求离圆心最远的整数点 hiho一下第111周 Farthest Point
// 圆内,求离圆心最远的整数点 hiho一下第111周 Farthest Point // 思路:直接暴力绝对T // 先确定x范围,每个x范围内,离圆心最远的点一定是y轴两端的点.枚举x的范围,再 ...
- C++读取、旋转和保存bmp图像文件编程实现
以前也遇到过bmp文件的读写.这篇博客很好,写的其他内容也值得学习. 参考:http://blog.csdn.net/xiajun07061225/article/details/6633938 学 ...
- PhoneGap,Cordova[3.5.0-0.2.6]:生成Android项目时出现错误(An error occurred while listing Android targets)
我在升级到Cordova最新版本(3.5.0-0.2.6)后,在生成Android项目(cordova platform add android)时出现错误: Error: An error occu ...