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
Define distributed queries. can you explain me as soon as possible
how to get second highest salary from a employee table and how get a 5th highest salary from a employee table by using proc sql?
how to stop execution of step 3 in a job mainframe
can any method return type may be constructor , or that method name allow
Find out the roles which gives access to all tables in SAP? Thanks in advance.
give idea for creating screen in abap
what is throws keyword
what is programmable BIST in today ic design
What is BASIS
what are the topics choosen for jam round for interviews
I am taking the bmc control m/enterprise manager 7.0 scheduling test and just wanted to see what kind of questions they would ask or if anyone has taken the test and how long it is for how many questions?
any drawback are there in mantis?
What are the Short cut Keys of Tally ERP?
what is the purpose of checked Menu options
Hi can you please send me recent(present) interview questions and technical qyestions with answers for "BUSSIESS OBJECTS" and "DATA WAREHOUSE".pls its urgent for me my mail id is sekhar.cs82@gmail.com,manjuforgis@gmail.com. thanks in advance