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
How do you sort an array in c#?
Explain the three services model (three-tier application). Presentation (ui), business (logic and underlying code) and data (from storage or other sources).
What is distribute by in hive?
How does foreach loop work in c#?
Is datetime a value type in c#?
You are creating a custom usercontrol, some of the newly created properties are shown in the properties window. How you can hide a new property named theme from the properties window?
Write a short note on interface?
Explain the importance and use of each, version, culture and publickeytoken for an assembly.
How will you get the different language strings?
Can abstract classes be final?
Which of these statements correctly declares a two-dimensional array in c#?
What is cshtml?
How long does a loop recorder procedure take?
What is a satellite assembly in c#?
Why to use “using” in c#?