April 14, 2015

C# try catch tricky question

What will be the output of below program?

static void Main()
        {
           
try
            {
               
int A = 0;
               
int Y = 5;
               
int X = Y / A;
            }

           
finally
            {
               
Console.WriteLine("I am in finally block");
               
Console.ReadKey();
            }
        }

This program will generate run time exception and Application will get terminated.

No comments:

Post a Comment