This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Beginning Java and the fly likes System.exit(int status) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "System.exit(int status)" Watch "System.exit(int status)" New topic
Author

System.exit(int status)

Steven Zeng
Ranch Hand

Joined: Jan 15, 2002
Posts: 41
Hi, if the status argument of System.exit(int status) is a non-zero number,what does it mean?
As far as I know ,the non-zero argument here means abnormal exit,but is there specific meaning of different int arguments?


SCJP2
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9044
    
  10
You can set different ints to mean different things in your *.bat file that called the java app. Traditionally zero indicates a successful exit with no errors while one indicates something went wrong and the program exited abnormally.

Most of the time (unless you're writing GUI stuff) you won't need to deal with System.exit at all.


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: System.exit(int status)