首页 > Windows开发 > 详细

InterviewQuestion_C#_程序题_003

时间:2017-08-23 23:46:16      阅读:375      评论:0      收藏:0      [点我收藏+]

分析代码,写出程序的输出结果:

文件: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 }

输出结果:

技术分享

 

InterviewQuestion_C#_程序题_003

原文:http://www.cnblogs.com/jswl/p/7420735.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!