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 do you assign a value to a complex number 7 how has exception hand changed in .net framework 4.0?

986


What is the use of view model in asp.net mvc?

1170


What is meant by domain model?

1105


what is conceptual model?

1088


What is meant by tempdata in mvc?

1053


How does the .net framework 3.0 relate to windows vista?

1072


What is session state management?

1053


How to bind table colum with gridview column?

1188


What is Separation of Concerns in ASP.NET ASP.Net MVC?

1259


What are advantages of Dependency Injection (DI) in ASP.Net MVC?

1141


Can you please explain the request flow in ASP.NET MVC framework?

1179


Can you use Razor code in Javascript in ASP.Net MVC?

1250


What are the two ways to add constraints to a route?

1027


Is mvc 4 supporting windows azure sdk (software development kit) ?

1086


Can you explain renderbody and renderpage in asp.net mvc?

1074