Answer Posted / shadab alam
Yes Yes
Two catch block can be executed at one time.
The example is given bellow .
using System;
class ab
{
public static void Main()
{
int []arr=new int[2]{2,3};
int a=9;
int b=0;
try
{
int r=a/b;
}
catch(DivideByZeroException d)
{
Console.WriteLine(d.ToString());
}
catch(Exception aa)
{
Console.WriteLine(aa.ToString());
}
finally
{
Console.WriteLine(arr[3]);
}
}
}
output will be
-------------
System.DivideByZeroException: Attempted to divide by zero.
at ab.Main()
Unhandled Exception: System.IndexOutOfRangeException: Index
was outside the boun
ds of the array.
at ab.Main()
| Is This Answer Correct ? | 6 Yes | 16 No |
Post New Answer View All Answers
What is the default value of decimal in c#?
what are the contents of an assembly ?
What is the use of console?
What is a long in c#?
What is lock statement in C#?
Explain the three services model (three-tier application). Presentation (ui), business (logic and underlying code) and data (from storage or other sources).
hi all.... i need code snippets for store and retrive tiff fromat images in sqlserver....... kindy provide it.......
Is php better than c#?
What is a lambda expression in c#?
What do you understand by 'access specifiers' in C#?
Can we inherit a private class in c#?
How can I create a process that is running a supplied native executable (e.g., Cmd.exe)?
What is class in oops with example in c#?
What is public or shared assemblies ?
Can private virtual methods be overridden in c#.net?