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?

Answers were Sorted based on User's Feedback



Can two catch blocks be executed?..

Answer / gyana

NO,we cannot use two catch block.It can't be executed.

Is This Answer Correct ?    2 Yes 3 No

Can two catch blocks be executed?..

Answer / guest

yes. not only 2 catch blocks but 'N' number of catch blocks
associated with respective try block can be executed.

Is This Answer Correct ?    1 Yes 7 No

Can two catch blocks be executed?..

Answer / 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

More C Sharp Interview Questions

Why is it a bad idea to throw your own exceptions?

1 Answers   Visual Soft,


Define c# and list the features.

0 Answers  


What is Web.config?

0 Answers   Amazon,


What is the difference between method and function in c#?

0 Answers  


Does the system.exception class have any cool features?

0 Answers  


What are primitive data types in c#?

0 Answers  


What is private void in c#?

0 Answers  


Can we change static variable value in c#?

0 Answers  


Why singleton class is sealed?

0 Answers  


What is the difference between method overriding and method overloading?

0 Answers  


What Is The Difference Between ViewState and SessionState?

1 Answers   Fiserv,


Hello Friends..am Mohammed riyash..final year BCA in Jamal Mohamed College 2009. Trichy. My doubt is while connecting SQL2005 Built in Database withing the Visual Studio 2005 Framework.. I am getting the error.. That " An Error occurred and it may be due to , under the default settings of the Server, the connection cannot be established.." But the code works in MS Access for me.. Both in VB.Net and C#.Net am getting the same error.. Any genius please Message me to 9994558822 or mail me.. riyash.ips@gmail.com

3 Answers  


Categories