The difference between System.exit(1), System.exit(0), and return in java

System.exit (0) exits the program normally, and System.exit (1) or non-zero means exits the program abnormally

    System .exit(status) will exit the program regardless of the value of status.

Compared with return, there are the following differences: return is to return to the previous layer, while System.exit(status) is to return to the top layer


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324797095&siteId=291194637