Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

try catch and finally blocks

 
narasimha munagala
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi to everyone
I am new to java i want to know
in all the try ,catch,finally blocks return statements exists
if an exception raised in the try block then which return
statement execute
and if an exception not raised in the try block then
which return stetment execute.
Any one know answer for this question please give me answer
thank you
 
Bill Cruise
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The return statements for both the try and catch blocks will get suppressed by the finally block. You'll end up with the return value from your finally block whether an exception is thrown or not.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic