| Author |
arguments of System.exit()
|
Krishna Acharya
Greenhorn
Joined: Jun 05, 2007
Posts: 29
|
|
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
Joined: Feb 07, 2005
Posts: 2341
|
|
|
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
Bartender
Joined: Aug 16, 2005
Posts: 12950
|
|
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.
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
 |
|
|
subject: arguments of System.exit()
|
|
|