Answer Posted / shadab alam
yes two catch block can be executed .
Sorry for privious Error!whrer two catch block are not
executd but this time it has been executed
Now This is right answer here two
using System;
class a
{
public static void Main()
{
int a=8;
int b=0;
int [] arr=new int[]{1,2};
try
{
Console.WriteLine(a/b);
}
catch(Exception e)
{
Console.WriteLine(e.ToString());
Console.WriteLine("Hello");
}
finally
{ try
{
Console.WriteLine(arr[2]);
}
catch(IndexOutOfRangeException d)
{
Console.WriteLine(d.ToString
()+ "hello");
Console.WriteLine("Hello");
}
}
}
}
output will be
----------------
System.DivideByZeroException: Attempted to divide by zero.
at a.Main()
Hello
System.IndexOutOfRangeException: Index was outside the
bounds of the array.
at a.Main()hello
Hello
Is This Answer Correct ? | 12 Yes | 3 No |
Post New Answer View All Answers
Is c# dictionary a hash table?
What does mean before a string in c#?
What issues can be faced while delivering code?
What does m mean in decimal c#?
What do u mean by delegation of authority?
What is the advantage of dependency injection?
What are the problem with .NET generics?
What is the difference between select and selectmany?
Is linkedhashset synchronized?
Explain more on CLR
What is the difference between dataset and datatable in c#?
What is difference between string and stringbuilder in c#?
How to exclude a property from xml serialization?
Explain the difference between a Private Assembly and a Shared Assembly
What is the difference between icomparer and icomparable in c#?