Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Can two catch blocks be executed?

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


Please Help Members By Posting Answers For Below Questions

What does assert() do in c#?

944


What is marshalling in c#?

817


How to handle exceptions that are raised in a component?

1024


How does dictionary work in c#?

820


What is gui in c#?

933


Perfect Example Of While And Do-While Loop In C#.Net ?

928


Which is faster iqueryable or ienumerable?

938


Explain the difference between boxing and unboxing.

964


What is difference between ienumerable and list in c#?

823


How do I do implement a assert?

922


What Is A Satellite Assembly?

908


What is a Managed Code??

962


What are jump statements in c#?

888


What is difference between private and protected?

942


How does foreach loop work in c#?

904