阅读以下程序public class Count{static int count;int number;public Count(){count = count + 1;number = count;}}class Test{public static void Main(){Count a = new Count();Count b = new Count();Count c = new Count();}}程序运行后,对象a的count值是()
查看答案
class Test{int x;static int y;static void Main(){Test t = new Test();t.x = 1;t.y = 1;test.x = 1;test.y = 1;}}以上程序中共有几句错误()
A. 1
B. 2
C. 3
D. 4
以下关于this的说法不正确的是()
A. 在类的实例构造函数中,关键字this表示当前的类实例或对象的引用。
B. 在类的实例函数成员中,关键字this表示当前的类实例或对象的引用。
C. 关键字this不能用在静态构造函数中。
D. 关键字this能用在静态函数成员中。
阅读以下程序class A{public static int x;static A(){ x = B.y + 1;}}class B{public static int y = A.x + 1;static B(){}static void Main(){Console.Write(“{0},{1}”,A.x,B.y);}}以上程序运行后的输出结果是()
A. 2,1
B. 1,1
C. 1,2
D. 2,2
执行下列语句产生的结果是public class EnumTest{enum Days{Sun = 1,Mon,Tue,Wed,Thu,Fri,Sat};static void Main(){int x = 1;if(x == Days.Sun)Console.WriteLine("Equal ");elseConsole.WriteLine("Not Equal ");Console.ReadKey();}}
A. Equal
B. Not Equal
C. 编译错误
D. 运行时错误