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
Do unused Namespaces in c# affect run-time performance?
What is difference between code access and role based security?
What is difference between events and delegates?
What do you mean by sealed classes and static classes?
How can I create a process that is running a supplied native executable (e.g., Cmd.exe)?
Are objects passed by reference in c#?
What language is c# similar to?
Can you prevent a class from being instantiated?
I wish to create a windows application to perform a similar function as that of the "Search" which is provided to look for related files and folders in the System.. What steps must i follow??
What is data hiding in c#?
Is it possible to execute multiple catch block for a single try statement?
Which of the following API is used to hide a window?
What is session and cookies in c#?
Write a syntax for writing a event delegate.
Does c# support properties of array types?