0

Hello,

what is the meaning of System.exit() ?

if System.exit(0) = close the program without error

But, what is the meaning of System.exit(1) ?

Is there is any System.exit(2), System.exit(3), etc ?

Thanks you

4
Contributors
3
Replies
20
Views
3 Years
Discussion Span
Last Post by ~s.o.s~
0

any integer will work so that the system can exit. A zero value in exit() will cause no action taken to the error. A non-zero value in exit() will deal with the error using a routine that you need to write.

Hope that helps :)

0

When you execute any program (eg from a batch file or script) the program returns an integer return code; by convention this is 0 for successful execution. The batch file or script can then test that value to select an appropriate next thing to do.
System.exit(n) just makes the JRE finish exceuting and return the value n as its return code. n can be any int value.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.