Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

If we write return statement in finally block will it works
fine or throws any error?

Answer Posted / avinash kumar

We can not write any type of return statement inside the
finally block...The reason behind it,finally is block
should have to execute in any case.Return statment is fine
when no exception is generated or generated exception is
properly catched,in these two cases control can easily go
back to caller of method or a method can able to return a
valid datatype..
But what happen when an exception is
generated and is not caught,in this case also finally block
will exectute.After the execution of finally block the
control should goto the Runtime environment,means control
should should go away from the execution.But keeping the
return statement inside finally block,in this case
execution plan force the runtime environment to give the
control to the caller of the method.
So for this reason we
can not put any type of return statement inside finally
block.Because complier checks all the possiblities....

Is This Answer Correct ?    8 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can I return string result from action in asp.net mvc?

1054


What is .net architecture and framework?

1043


How does the 'page lifecycle' of asp.net mvc works?

1094


Explain the role of assembly in the .net framework.

1017


What is the full form of sp?

997


How large is the .net framework 3.0? Does this change make the release larger?

1012


what is dot net? what is use dot net? what is benifit of dot net?what is vb dot net? what is ado dot net? what is c#?

2298


What are ajax helpers in asp.net mvc?

1075


Explain the types of Scaffoldings.

1090


How to change the action name in ASP.Net MVC?

1070


Which filter executes first in an asp.net mvc application?

980


How does �side by side� work for the .net framework 3.0?

977


What is the use of razor view engine?

974


Is it possible to combine asp.net webforms and asp.mvc and develop a single web application?

994


What are the 3 main components of an asp.net mvc application?

1036