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 try is followed by finally block what happen to exception
occured in try block

Answers were Sorted based on User's Feedback



if try is followed by finally block what happen to exception occured in try block..

Answer / yogita

Finally block wil anyways gets executed bcoz it meant to be
executed even the error occurs.
And, error wil also occur since purpose of catch block is
to handle the exception occured in try block and present it
to user in a user friendly manner. If error has not been
handled in catch block, it will stil show the system error
msg(not the user understandable messgae what we generally
do)

Is This Answer Correct ?    11 Yes 1 No

if try is followed by finally block what happen to exception occured in try block..

Answer / solanki_mca

well, in this case you have not written any code to handle
Exception so u will get exception in the form of error.

Because if any exception occurs in try block control(run
time environment) searches for its corresponding catch
block, and if it will not found any it will raise the error
and control willl not be able to reach inside finally block
so code written inside will not be executed.

class abc
{
public static void Main(String[] args)
{
try
{
// some code here which cause erorr.
}

finally
{
// control will not come inside
// code to clean up system resources.

}
}


Even if u write catch block which does not belongs to
particular exception that has occured, in this case also
you will get error.

So if you are not sure about kind of exception that could
be occured; implement catch block which catches any kind of
exception as below.


class abc
{

try
{
// some code that will raise ArrayIndexOutOfBound xception
}

catch(ArithmeticException ex1)
{
// some code
}

catch(Exception err)
{
// code that will be handle to any kind of exception
}

finally
{
// clean up code
}
}

Regards,
Hitesh

Is This Answer Correct ?    7 Yes 4 No

if try is followed by finally block what happen to exception occured in try block..

Answer / raju

error occurs

Is This Answer Correct ?    2 Yes 5 No

Post New Answer

More Programming Languages AllOther Interview Questions

which worker is involved in all the phases of SDLC?

0 Answers  


I am looking for selenium RC online Training in chennai. can any one tell me the best institute

0 Answers  


whats the Need for Concurrency control

1 Answers  


What is the best action a system can take when deadlock is detected

2 Answers  


How does the TCP handle the issue of multiplexing?

0 Answers  


Write a shell program where you enter a number which corresponds to K.M. Find out the corresponding values in m, cm, inches, and feet. Hints:- 1 k.m= 1000 m 1 m= 100 cm 1 inches= 2.54 cm. 1 feet= 12 inches

0 Answers  


What are the Advantages of HashMap over Vector?

1 Answers  


how to display xisheet in list box in c# .net

0 Answers  


How to print No.of.rows affected after updation using ADO.Net

0 Answers   Tech Mahindra,


what is meant by life cycle of a business

0 Answers   IBM,


details description on this mantis? who is founder of this mantis?

0 Answers  


Tell me the jobs for the MCA Fresher in delhi, Noida..

0 Answers  


Categories