| Author |
Send answer to my dout ie difference b/w System.exit(0) and System.exit(1)
|
nagaraju parepally
Greenhorn
Joined: Aug 04, 2005
Posts: 2
|
|
Hai, What is the difference b/w System.exit(0) and System.exit(1)? I am little bit dout on >>> operator plz clarify my dout
|
 |
Marilyn de Queiroz
Sheriff
Joined: Jul 22, 2000
Posts: 9033
|
|
System.exit(0) does the same thing as System.exit(1) It is a command that stops the entire JVM Unless you are calling the program with a bat file and do something with the return value of the program, it makes no difference which one you use.
|
JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
|
 |
Steve McCann
Ranch Hand
Joined: Oct 20, 2004
Posts: 81
|
|
The integer is returned as an exit code. The convention is to return 0 i.e. System.exit(0) if the application terminated correctly (without any errors). If you want to return any other number for reporting errors/exeptions to outside the program you can do this with something like... Hope this makes sense. Steve
|
 |
fred rosenberger
lowercase baba
Bartender
Joined: Oct 02, 2003
Posts: 10043
|
|
System.exit(<some integer> is a function call like anything else. you're saying "Shut down the JVM, and pass the integer value to the OS. by using different values, you can signal WHY the JVM was shut down. The values have no inherent meaning, but customarily 0 means "everything was just fine". any other value means something bad happened, but that's for you to determine when you write the code.
|
Never ascribe to malice that which can be adequately explained by stupidity.
|
 |
Barry Gaunt
Ranch Hand
Joined: Aug 03, 2002
Posts: 7729
|
|
As I explained to you (nagaraju) before, please keep unrelated questions in separate topics.
I am little bit dout on >>> operator plz clarify my dout
Create a new topic for the above question. And say what exactly you do not understand about the ">>>" shifting operator. I you have read something about the operator, and you do not understand it, then quote what you have read.
|
Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
|
 |
 |
|
|
subject: Send answer to my dout ie difference b/w System.exit(0) and System.exit(1)
|
|
|