• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Send answer to my dout ie difference b/w System.exit(0) and System.exit(1)

 
nagaraju parepally
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9059
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Steve McCann
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12084
29
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic