What will be the output of the following C# code snippet? [code] class Output { public static void main(String args[]) {

What will be the output of the following C# code snippet?
Code:
 class Output 
 {
     public static void main(String args[]) 
    {
        try 
        {
            int a = 0;
            int b = 5;
            int c = a / b - 5;
            Console.WriteLine("C");
        }
        finally 
        {
            Console.WriteLine("sharp");
        } 
    }
}
A. C
B. sharp
C. Csharp
D. None of the mentioned
 
Answer: c
Explanation: finally block is always executed after try block, no matter if the exception is found or not.
 

Tìm kiếm

Back
Top