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
how do u handle table control inbdc explain the process in steps iwant the answer in urgent please forward this even i know how to explain there
What are events in smartforms?
Write a pascal program to calculate the sum of the first 100 even number and odd number
how to convert infix expression to prefix expression?
what is the system development cycle
Plz sent me in .net 2.0 interview Question & answers?
what is the meaning of without standing arrears?
How to connect the .accdb database file of microsoft access to the Visual Basic 6.0 forms?
what is radio button? Plz show code this! how will select radio buttons to go next window Forms? Supose o radio button1 o radio button2 o radio button3 o radio button4 how will coding this? Plz explain this!
Explain the types of operations? Draw the figure for shift and rotate operations?
write a query that returns one row for each department and the number of employees in that department. Given two tables EMPLOYEE and DEPARTMENT, where there can be multiple employees per department.
Why did you ever become involved in QA/testing?
how to add Servlet-api.jar file into eclipse 3.3.2 ?
What ports must be open for DCOM over a firewall? What is the purpose of Port 135?
WHAT IS MAIN IMPORTANT THING IN SOFTWARE?