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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can we develop a multi-tier application in Java?

1946


1.Mutating table

1929


What is the use of sas software? Is sas and sap are different?

1576


How to merge Action Form with Dyna Action Form in Struts.

2365


Write a program to create a process in UNIX

2602


Difference between debugging, running, executing of an application

4096


What is the difference between WebIntelligence and Designer in creating universes?

2126


< DL Compact > tag is used for

1997


Difference between HTML and DHTML?

2327


What is the difference between DECISION COVERAGE(DC) and MODIFIED CONDITION/DECISION COVERAGE(MCDC)?

2322


Can any one give an example (Source Code) on virtual function implemetation in Java?

2062


how to generate dsnless connectivity in j2ee

2069


Write a program to find factorial of a number using functions

1759


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

2035


Plz sent me in .net 2.0 interview Question & answers?

2174