e martë, 15 janar 2008

Question on exception / try - catch block

Question:

What will be the output for follwing code

try
{
Console.WriteLine("Before Exception");
throw new Exception("Raising exception");
Console.WriteLine("After Exception");
}
catch(Exception e)
{
Console.WriteLine("Inside Catch");
}
finally
{
Console.WriteLine("Inside Finally");
}
Console.WriteLine("Outside Try");

Answer:

Before Exception
Inside Catch
Inside Finally
Outside Try

Nuk ka komente: