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 is new method in c#?
How does inheritance work in c#?
How long has c# been around?
Does c# do array bounds checking?
What is a method signature?
What is an example of a delegate?
Explain the Different types of configuration files in .net?
What is difference between ilist and list in c#?
What is the difference between out and ref in c#?
what is be the overhead, if i use binary transmission. and will it be sent using xml text or how ?
What is the purpose of c#?
What is the default modifier for class in c#?
What is the use of thread join in c#?
What is datetime minvalue in c#?
Explain what is the smallest unit of execution in .net?