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

How do you sort an array in c#?

1016


Explain the three services model (three-tier application). Presentation (ui), business (logic and underlying code) and data (from storage or other sources).

919


What is distribute by in hive?

1079


How does foreach loop work in c#?

982


Is datetime a value type in c#?

892


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?

934


Write a short note on interface?

1001


Explain the importance and use of each, version, culture and publickeytoken for an assembly.

933


How will you get the different language strings?

944


Can abstract classes be final?

949


Which of these statements correctly declares a two-dimensional array in c#?

1069


What is cshtml?

1037


How long does a loop recorder procedure take?

1007


What is a satellite assembly in c#?

1006


Why to use “using” in c#?

1076