lenelex.com
Home
Quizzes
Games
Register
Log in
Question 1 of 14
What is the output of the following program?
class A { static A() { Console.Write(" > static()"); } public A() { Console.Write(" > new()"); } public A(int p) { Console.Write($" > new({p})"); } } class Program { static void Main() { foreach (var p in new int[] { 1,2, 3}) { A a = new A(p); Console.WriteLine(); } } }
A. > new(1) > static() > new(2) > new() > new(3) > new()
B. > static() > new(1) > new(2) > new(3)
C. > new() > new(1) > new() > new(2) > new() > new(3)
D. > new(1) > new(2) > new(3)
E. > static() > new(1) > static() > new(2) > static() > new(3)
Links:
Class
Static Constructors