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 Named parameter in C#?
What is cosole application?
What is int32 in c#?
What is dbcontext c#?
What is the difference between the debug class and trace class? Documentation looks the same.
How do you convert byte array to hexadecimal string, and vice versa?
Explain partial class in c#?
What are data types with examples?
Can we inherit a private class in c#?
What is the concept of strong names?
Will the following code compile?
Explain the functionalities of satellite assembly?
What is an assembly in .net?
What are custom attributes in c#?
i want o/p 011242110 in c# code.