Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

will the finally execute if a return statement present in try block?  RSS feed

 
vijay kumarg
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Members,

I am happy to be a member of javaranch.
My first question( may be simple!)
If we have areturn statement in try will the finally still executes?
 
Richard Anderson
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, it will. Try it out.
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
 
Crace Selvage
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, the finally block executes. Always. Unless the jvm is killed off or a System.exit() is called.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!