What will be the output of the following C# code? [code] static void Main(string[] args) { int a = 10, b = 0; int result;

What will be the output of the following C# code?
Code:
 static void Main(string[] args)
 {
     int a = 10, b = 0;
     int result;
     Console.Out.WriteLine("This will generate an exception.");
     try
     {
         result = a / b; // generate an exception
     }
     catch (DivideByZeroException exc)
     {
         Console.Error.WriteLine(exc.Message);
     }
     Console.ReadLine();
 }
A. This will generate an exception
B. 0
C. Compile time error
D.
This will generate an exception
Attempted to Divide by Zero
 

Tìm kiếm

Back
Top