• Post Reply Bookmark Topic Watch Topic
  • New Topic

difference between exit(0), exit(1)  RSS feed

 
ramchander yshetti
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hai,
would you please tell me difference between
System.exit(0);
System.exit(1);
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you read the API documentation of System.exit(...)? It says:

"Terminates the currently running Java Virtual Machine. The argument serves as a status code; by convention, a nonzero status code indicates abnormal termination."

The exit code is passed back to the operating system. If you called the Java program from a Unix shell script or Windows batch file, then you can put commands in the script or batch file that look at the exit code and act upon it.

(This question does not belong in the 'Advanced' forum).
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!