Hi,
I would like to answer your questions..
1.try block with multiple catch statement , which one get executed
and how?
try
{
.... // database conn. logic
.
..}
catch(IOException e)
{
}
catch(SqlException e)
{
}
catch(Exception e)
{
}
When an exception is thrown it will check the 1st exception if the type doesnt match it will navigate to 2nd and so on untill it finds the correct type and if not found it will throw Exception and if it finds the correct type it wont check the other catch blocks.
You cant have a multiple finally block.There will be only one finally block for a try block.
if i right system.exit(1) in try blk thn aslo my finally blk get executed
The answer for this would be NO. Finally block will get executed for everything even if the try block has a return stmt but if it has system.exit() finally block wont get executed as that stmt would cause jvm to shut down.