System.exit()用来结束当前运行的java虚拟机,参数n表示退出的状态码。
这个状态码没有特别规定,但是按照约定俗成,非0表示异常退出,0表示正常退出,因此一般用0、-1多一些。c/c++里面也是这样的

解决方案 »

  1.   

    直接告诉你,还不如你自己去查J2SE API。这样你以后遇到类似问题就知道如何解决了。java.lang.System.exit(n) -> see also Runtime.exit(n)
      

  2.   

    The argument serves as a status code; by convention, a nonzero status code indicates abnormal termination. 呵呵,非0数就代表非正常终止啊:)
      

  3.   

    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. 
      

  4.   

    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.
    See Also: 
    Runtime.exit(int)