Results 1 to 4 of 4
Thread: System.exit 0 or 1?
- 11-13-2008, 09:18 AM #1
System.exit 0 or 1?
What is the difference b/w:
System.exit(0);
and
System.exit(1);
If I have the following code:
public class MathMistake
{
public static void main(String[] args)
{
int num = 13, denom = 0, result;
if (denom == 0)
System.exit(1);
result = num / denom;
}
}
Would I get the same result if I use the 0 or 1 for System.exit? :confused:
Thanks."The minute you settle for less than you deserve, you get even less than you settled for." Maureen Dowd
- 11-13-2008, 11:55 AM #2
Member
- Join Date
- Oct 2008
- Location
- Aberystwyth
- Posts
- 55
- Rep Power
- 0
- 11-13-2008, 04:41 PM #3
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
- 11-13-2008, 06:33 PM #4
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
The number is the "exit code" of the program. Generally 0 means the program executed and exited normally. Other than zero usually means an error occurred. Most programs use different exit codes for different "abnormal" exits and document them, that allows the program to be used in a script and evaluate it's exit status without having to do any kind of text evaluations.
Similar Threads
-
[SOLVED] exit code 2
By antgaudi in forum New To JavaReplies: 2Last Post: 09-21-2008, 10:03 PM -
System.exit() in catch block.
By new_2_java in forum Advanced JavaReplies: 8Last Post: 06-24-2008, 03:45 PM -
system.exit(..)
By ramakanta.majhi in forum New To JavaReplies: 2Last Post: 06-14-2008, 01:28 AM -
help with System.exit (1) function call
By katie in forum Advanced JavaReplies: 2Last Post: 08-06-2007, 08:03 PM -
How to exit the program..
By coco in forum New To JavaReplies: 1Last Post: 08-01-2007, 05:56 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks