Question
What would be the output of following code snippet?
{ try { int a, b; b = 0; a = 5 / b; Console.WriteLine("A"); } catch(ArithmeticException e) { Console.WriteLine("B"); } finally { Console.WriteLine("C"); } Console.ReadLine(); }
{ try { int a, b; b = 0; a = 5 / b; Console.WriteLine("A"); } catch(ArithmeticException e) { Console.WriteLine("B"); } finally { Console.WriteLine("C"); } Console.ReadLine(); }
Answer: Option C
Was this answer helpful ?
finally keyword is used to execute before catch and try block is executed.
Output : B C
Was this answer helpful ?
Submit Solution