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 binding in c#?
What operator means?
What is a dbml?
Explain About namespaces
What are "class access modifiers" in C#?
what are the differences between a class and structure
What is gac? How to put assembly in gac?
What is connection pooling in ado.net?
What is method and function in c#?
What is difference between struct and class in c#?
How do you convert byte array to hexadecimal string, and vice versa?
What are the advantages of generics in c#?
How to use nullable types in .net?
Explain nullable types in c#?
How can you set image source dynamically from c# application to ”test.png” file?