JAVA System.exit(0) 和 System.exit(1) 的区别

System.exit(int state) 方法都是来结束当前运行的java虚拟机。所有System.exit(1)、System.exit(0) 执行后都会退出程序。

state为0时时正常退出,非0时为异常退出。所以System.exit(1) 常用于 catch中。

posted @ 2019-02-22 14:34  愚钝的Tom  阅读(1130)  评论(0编辑  收藏  举报