我也只知道0为正常退出,但不知道其他值有什么意义我原来也问过这个问题,大约是一个不需了解太清的问题status不管是多少的时候,都可以触为用addShutdownHook安装的ShutdownHook。

解决方案 »

  1.   

    O是正常退出,非零的是不正常退出。它也等于Runtime.getRuntime().exit(n) 
    n是表示状态的,我目前只知道这么多 ;)
      

  2.   

    当程序正常退出时,status为0,若异常退出则为其它数字;
    主要用于检查程序是否正常退出。
      

  3.   

    没想到刷新这么快,Runtime类的exit(n)是暂停调用getRuntime()函数的对象进程的执行并向父进程返回n值,0正常中止,非0不正常,status数字之用由此可见一斑!!System类exit()也是此意,
      

  4.   

    to ratinwander:
    程序都已经退出,怎么还能捕获?而且也没有返回值。
      

  5.   

    exit public static void exit(int status)Terminates the currently running Java Virtual Machine. The argument serves as a status code; by convention, a nonzero status code indicates abnormal termination. This method calls the exit method in class Runtime. This method never returns normally. The call System.exit(n) is effectively equivalent to the call:  
    Runtime.getRuntime().exit(n) Parameters:status - exit status. Throws: SecurityException - if a security manager exists and its checkExit method doesn't allow exit with the specified status
      

  6.   

    这个退出值是提供给其它程序判断的
    比如A创建了B进程,B exit(status)了,在A里面可以获得这个status来判断B是否正常退出了