What will happen when Mark attempts to compile and execute the code snippet?

Mark works as a Software Developer for Mansoft Inc. He develops an application using Visual

Studio .NET 2005.

He writes the following code snippet in the application:

public class MyClass

{

public static void Main(String[] args)

{

try

{

return;

}

finally

{

Console.WriteLine("Finally");

}

}

}

What will happen when Mark attempts to compile and execute the code snippet?
A . The code snippet will compile successfully and the output will be displayed as "Finally".
B . The code snippet will compile successfully, but an exception message will be displayed at ru ntime.
C . A compile-time error will occur because the catch block is not defined.
D . The code snippet will compile successfully, but nothing will be displayed as output on execu tion.

Answer: A

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments