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
What does assert() do in c#?
What is marshalling in c#?
How to handle exceptions that are raised in a component?
How does dictionary work in c#?
What is gui in c#?
Perfect Example Of While And Do-While Loop In C#.Net ?
Which is faster iqueryable or ienumerable?
Explain the difference between boxing and unboxing.
What is difference between ienumerable and list in c#?
How do I do implement a assert?
What Is A Satellite Assembly?
What is a Managed Code??
What are jump statements in c#?
What is difference between private and protected?
How does foreach loop work in c#?