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

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 :)

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.

A word of caution though, even though the System.exit method accepts the entire gamut of integer values, there are certain restrictions imposed by the host systems (operating systems) on what kind of status codes are acceptable.

Take a look here: http://en.wikipedia.org/wiki/Exit_status

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.