class Class1 { public static int Count = 0; static Class1() { Count++; } public Class1() { Count++; } } Class1 o1 = new Class1(); Class1 o2 = new Class1(); 请问,Class1.Count的值是多少?( )( 2 分)
举一反三
- 以下语句能顺利通过编译: abstract class class1 { } public class mainClass { public static void main(String args[]) { class1 cs1=new class1(); } } 。()
- 以下程序的运行结果是______ abstract class class1{abstract void method1();}class class2 extends class1{public void method1(){ System.out.println("子类");}}public class MainClass{public static void main(String args[]){class1 ac=new class2();ac.method1();}}
- 在C#中假设Class1是一个类,而IExample是一个接口,下面的( )类声明是正确的。 A: class Employee: Class1, IExample B: class Employee: IExample, Class1 C: class Employee- Class1, IExample D: class Employee: Class1/Iexample
- 阅读以下程序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值是() A: 0 B: 1 C: 2 D: 3
- abstract class BaseClass { public virtual void MethodA() { } public virtual void MethodB() { } } class Class1: BaseClass { public void MethodA(string arg){ } public override void MethodB(){ } } class Class2: Class1 { new public void MethodB(){ } } class MainClass { public static void Main(string[] args) { Class2 o = new Class2(); Console.WriteLine(o.MethodA()); } } 请问,o.MethodA调用的是 A: BaseClass.MethodA B: Class2.MethodA C: Class1.MethodA D: 都不是