【问题标题】:Why should we inform the JVM with exit status like exit(0), exit(1)? [duplicate]为什么要通知 JVM 退出状态,如 exit(0)、exit(1)? [复制]
【发布时间】:2016-05-10 17:39:40
【问题描述】:

我正在尝试弄清楚为什么我们应该用退出状态值(例如 0 或 1)通知 JVM。

需要什么?

例如:

class sample
{
    public static void main (String args[])
    {
        System.out.println("Calling System.exit()");
        System.exit(0);
    }
}

【问题讨论】:

  • 你不通知jvm,你通知用户。

标签: java


【解决方案1】:

退出代码不适用于 JVM。它适用于运行程序的用户/系统。

退出代码0 表示程序执行良好。任何其他的退出代码都表示错误。作为开发人员,您可以决定不同代码的含义,例如,您可以决定 4 的代码意味着数据库错误导致退出。

You can find a bit more information here.

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-03-14
    • 1970-01-01
    • 1970-01-01
    • 2017-02-28
    • 2021-01-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多