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
What is the Difference between in memory database and physical database
WHAT IS MAIN IMPORTANT THING IN SOFTWARE?
design a counter with the following repeated binary sequence: 0, 1, 2, 3, 4, 5, 6, 7, 8 using JK Flip Flop.
Hi I am Rathnam, How To Remove the duplicates with out using remove duplicate stage in the datastage
5.Call by value and Call by reference with program?
I want to pass .pdf files as OlE Object to crystal report through VB6. Please any one guid me...
Explain polymorphism. Provide an example.
Write a shell program. Enter number of days from keyboard. Find out the number of years, month and days it contains
a characteristic of a multiprogramming is? a.simultaneous exe of pgm instr 4m 2 appli b.concurrent processing of 2 r more prgms c.multiple cpu s d.all the abov
Compare any 4 software development life cycle paradigms with each other. Indicate at least one application for each of the paradigms that are suitable to developed using that paradigm.
Tips for blog integration by www.esteemwebsolutions.com. Can Any body suggest me to how to make wonderful questions on web integration..
4. What is the need of START 0? Instead if can we use any other numeric? If we use what will happen?
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
Write a program to show polymorphism.
How do i find out the number of parameters passed into function?