- 时间:2017-08-23 整理:byzqy
题目:分析代码,写出程序的输出结果:
文件:Program.cs
1 using System; 2 3 namespace Interview2 4 { 5 class A 6 { 7 public static int X; 8 static A() 9 { 10 X = B.Y + 1; 11 } 12 } 13 14 class B 15 { 16 public static int Y = A.X + 1; 17 static B() { } 18 static void Main() 19 { 20 Console.WriteLine("X ={0},Y ={1}",A.X,B.Y); 21 22 Console.ReadKey(); 23 } 24 } 25 26 }
输出结果: