java中System.exit(1)、System.exit(0)、以及return的区别

System.exit(0)是正常退出程序,而System.exit(1)或者说非0表示非正常退出程序

    System.exit(status)不管status为何值都会退出程序。

和return 相比有以下不同点:return是回到上一层,而System.exit(status)是回到最上层


猜你喜欢

转载自blog.csdn.net/weixin_39241397/article/details/80069968