10
Reply

Can multiple catch blocks be executed?

Gautam Kumar

Gautam Kumar

10y
3.1k
0
Reply

    Never when one catch block is executed, controls skip all other catch blocks and goes to finally block.

    No, Multiple catch blocks can't be executed. Once the proper catch code executed, the control is transferred to the finally block and then the code that follows the finally block gets executed.

    yes multiple catch is possible in c#

    No.Catch block that handles the exception will get executed and all other catch will be skipped and then control goes to finally block if there is any and then to subsequent code after the finally block. class A {static void Main(string[] args){try{int a = 10;int b = 0;int i = a / b;}catch (DivideByZeroException){Console.WriteLine("Inside Specialized Catch");}catch (Exception){Console.WriteLine("Inside Generalized Catch");}finally{Console.WriteLine("Inside Finally");}Console.WriteLine("Outside try/catch/finally --- I got chance to Run");} }

    yes we have multiple catch block . just type in google "can we have multiple catch for a single try in c# " you found out your answer

    No

    Never when one catch block is executed, controls skip all other catch blocks and goes to finally block.

    Never when one catch block is executed, controls skip all other catch blocks and goes to finally block.

    Never when one catch block is executed, controls skip all other catch blocks and goes to finally block.

    Never when one catch block is executed, controls skip all other catch blocks and goes to finally block.