This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

arguments of System.exit()

 
Krishna Acharya
Ranch Hand
Posts: 34
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,
Is there anybody to help me in clearifying the no of arguments that system.exit() can hold. For eg. System.exit(0), System.exit(1). In which circumstances we use System.exit(1)? Are there other arguments besides 0 and 1.

Thanks
 
Keith Lynn
Ranch Hand
Posts: 2399
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
System.exit only takes one parameter. You can make that parameter any int you want. Typically, you make it 0 to indicate that the program will exit normally. You make it a non-zero value to indicate there was a problem.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you call your Java program from a shell script (in Unix) or a batch file (in Windows), you can check the return value, which is the value you pass to System.exit(...), in the script or batch file.

Most Unix and Windows programs that return a value like this, return 0 when there's no error and something else when there is some kind of error.

What value you should return depends on what you want to do in the script or batch file under certain conditions.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic