InterviewQuestion_C#_程序题_003

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

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

输出结果:

时间: 2024-08-22 16:28:20

InterviewQuestion_C#_程序题_003的相关文章

InterviewQuestion_C#_程序题_004

分析代码,写出程序输出结果: 文件:Class1.cs using System; namespace Interview3 { class Class1 { private string str = "Class1.str"; private int i = 0; static void StringConvert(string str) { str ="string being converted."; } static void StringConvert(C

InterviewQuestion_C#_程序题_001

请写出下列程式的结果: 文件:A.cs 1 using System; 2 3 namespace InterView 4 { 5 public class A 6 { 7 public virtual void Fun1(int i) 8 { 9 Console.WriteLine(i); 10 } 11 public void Fun2(A a) 12 { 13 a.Fun1(1); 14 Fun1(5); 15 } 16 } 17 } 文件:B.cs 1 namespace InterVi

结对编程_附加题_博客2

1.界面模块,测试模块和核心模块的松耦合 2.改进程序 结对编程_附加题_博客2

Breaseman算法绘制圆形|中点算法绘制圆形_程序片段

Breaseman算法绘制圆形|中点算法绘制圆形_程序片段 1. Breaseman算法绘制圆形程序 由于算法的特殊性,限制绘制第一象限部分,其他部分通过旋转绘制. 1 void CCGProjectWorkView::bresenHam_1P4Circle(int radium, const float lineColor[]) 2 { 3 int pointX, pointY, deltD, deltHD, deltDV, direction; 4 pointX = 0; 5 pointY

Javascript基础练习之实现C语言经典程序题

前言: 最近在学习Javascript语言,看到网上很多都是在介绍Javascript如何解决网页上问题的代码,所以想另辟蹊径,用Javascript代码来实现C语言经典程序题.当然,这些C语言程序题也是比较简单,主要想通过Javascript语言实现,起到语法练习作用,也想来对比一下C语言和Javascript语言实现的相同点和不同点,从而巩固记忆,加强学习效果!!! 一.C语言经典程序题1 1. 题目描述: 马克思的手稿中有这样一道有趣的数学题:有30个人,其中有男人,女人,小孩.他们在一家

逻辑运算_三元运算符_程序流程控制

 //逻辑运算符   /*       逻辑运算符用于连接布尔型表达式,在Java中不可以写成3<x<6,应该写成x>3 & x<6 .      "&"和"&&"的区别: 单&时,左边无论真假,右边都进行运算:       双&时,如果左边为真,右边参与运算,如果左边为假,那么右边不参与运算.       "|"和"||"的区别同理,||表示:当左边为真

HDU 4941 Magical Forest _(:зゝ∠)_ 模拟题

模拟大法保平安_(:зゝ∠)_ #include <cstdio> #include <map> #include <set> #include <algorithm> using namespace std; const int N = 1; struct node{ int x, y, val; node(int a=0,int b=0,int c=0):x(a),y(b),val(c){} bool operator<(const node&am

HDU 1162 Eddy&#39;s picture (prime算法_裸题)

Problem Description Eddy begins to like painting pictures recently ,he is sure of himself to become a painter.Every day Eddy draws pictures in his small room, and he usually puts out his newest pictures to let his friends appreciate. but the result i

.net core使用HttpClient发送代理请求_程序内抓包_Fiddler抓包

原文:.net core使用HttpClient发送代理请求_程序内抓包_Fiddler抓包 前言:  通过Fiddler抓取浏览器请求数据,相信大家已经都会用了,我们知道Fiddler是通过在本机计算器添加一个默认的代理服务器来实现的抓包数据的,端口号为:8888. 其实当我们打开Fiddler的设置也可以看到: 然后查看本地计算器的网络代理设置: 基于上面的原理,Fiddler就实现了经过本机计算器请求的数据抓包了... 那么,我们通过C#代码,在.net Core中使用HttpClient