Click here to Skip to main content
15,903,012 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
what is the difference between exit(0) and exit(1) keywords in JAVA???
Posted

exit(0) means your program ended normally.
exit(1) or exit(n) returns a error code :)
 
Share this answer
 
Comments
Tamanna9931 19-Aug-11 14:28pm    
what kind of error will be returned by exit(n) or exit(1)????
Sergey Alexandrovich Kryukov 20-Aug-11 0:04am    
There is no conventions about it. It's customary to use 0 as "no problem", all other values are defined by application program and should be documented by its developer. These days this value rarely used. One example: console application used as a build step in building of software project. Even in this field this feature is superseded by MSBuild which offer interface for special assemblies.
--SA
exit(int status) terminates the current Java application and returns the status value to the invoking process, either another application or the operating system shell. The returned value can be used to indicate success or failure.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900