12
Reply

Can multiple catch blocks be executed?

Gautam Kumar

Gautam Kumar

11y
9k
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.

    No ITs not possible can you please check this link for brief explanation

    https://youtu.be/sdjR0D5nyqQ

    Yes its possible..can you please check this url (it has an example for it)

    https://youtu.be/sdjR0D5nyqQ

    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.