Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

System.exit(0) &System.exit(1)

 
harish shankarnarayan
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can anyone give me some idea about using ,wat exactly happens
System.exit()
in try-catch-finally block
all the cases.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well if the JVM goes down before finally gets to run, then the finally block won't run. Otherwise finally will be run.

Mark
 
Gagan Deep
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mark,

Will number in System.exit(number) matter?

What is the difference between System.exit(0) & System.exit(1)?

Thanks
Gagan.
 
Jay Pawar
Ranch Hand
Posts: 411
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Gagan Deep:
Mark,

Will number in System.exit(number) matter?

What is the difference between System.exit(0) & System.exit(1)?

Thanks
Gagan.


The argument serves as a status code; by convention, a nonzero status code indicates abnormal termination.

HTH
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic