中国大学MOOC: 试图编译和运行以下代码的结果是:classBase{privateBase(){System.out.println(0);}publicBase(inti){System.out.println(i);}}publicclassTestextendsBase{publicTest(){super(1);};publicstaticvoidmain(Stringargv[]){Testt=newTest();}}
中国大学MOOC: 试图编译和运行以下代码的结果是:classBase{privateBase(){System.out.println(0);}publicBase(inti){System.out.println(i);}}publicclassTestextendsBase{publicTest(){super(1);};publicstaticvoidmain(Stringargv[]){Testt=newTest();}}
中国大学MOOC: 在以下代码中,下列哪句可以放在//Here处?classBase{publicBase(inti){}}publicclassMyOverextendsBase{publicstaticvoidmain(Stringarg[]){MyOverm=newMyOver(10);}MyOver(inti){super(i);}MyOver(Strings,inti){this(i);//Here}}
中国大学MOOC: 在以下代码中,下列哪句可以放在//Here处?classBase{publicBase(inti){}}publicclassMyOverextendsBase{publicstaticvoidmain(Stringarg[]){MyOverm=newMyOver(10);}MyOver(inti){super(i);}MyOver(Strings,inti){this(i);//Here}}
已知接口IHello和类Base、MyClass的定义如下interfaceIHello{voidHello();}classBase:IHello{publicvoidHello(){System.Console.WriteLine("HelloinBase!");}}classDerived:Base{publicvoidHello(){System.Console.WriteLine("HelloinDerived!");}}则下列语句在控制台中的输出结果为_____。IHellox=newDerived();x.Hello(); A: HelloinBase! B: HelloinDerived! C: HelloinBase!HelloinDerived! D: HelloinDerived!HelloinBase!.
已知接口IHello和类Base、MyClass的定义如下interfaceIHello{voidHello();}classBase:IHello{publicvoidHello(){System.Console.WriteLine("HelloinBase!");}}classDerived:Base{publicvoidHello(){System.Console.WriteLine("HelloinDerived!");}}则下列语句在控制台中的输出结果为_____。IHellox=newDerived();x.Hello(); A: HelloinBase! B: HelloinDerived! C: HelloinBase!HelloinDerived! D: HelloinDerived!HelloinBase!.
关于以下程序,其编译和运行结果为()</p></p>classBase{</p></p>publicBase(){</p></p>System.out.print('B');</p></p>}</p></p>}</p></p>publicclassTestDemoextendsBase{</p></p>intm=1;</p></p>publicTestDemo(){</p></p>System.out.println('A');</p></p>}</p></p>publicstaticvoidmain(Stringargs[]){</p></p>TestDemot=newTestDemo();</p></p>}</p></p>}</p></p>
关于以下程序,其编译和运行结果为()</p></p>classBase{</p></p>publicBase(){</p></p>System.out.print('B');</p></p>}</p></p>}</p></p>publicclassTestDemoextendsBase{</p></p>intm=1;</p></p>publicTestDemo(){</p></p>System.out.println('A');</p></p>}</p></p>publicstaticvoidmain(Stringargs[]){</p></p>TestDemot=newTestDemo();</p></p>}</p></p>}</p></p>
对于一下程序,其运行结果为</p></p>classBase{</p></p>publicBase(){</p></p>System.out.print("C");</p></p>}</p></p>}</p></p>classBase2extendsBase{</p></p>publicBase2(){</p></p>System.out.print("B");</p></p>}</p></p>}</p></p>publicclassTestDemoextendsBase2{</p></p>intm=1;</p></p>publicTestDemo(){</p></p>System.out.println("A");</p></p>}</p></p>publicstaticvoidmain(Stringargs[]){</p></p>TestDemot=newTestDemo();</p></p>}</p></p>}</p></p>
对于一下程序,其运行结果为</p></p>classBase{</p></p>publicBase(){</p></p>System.out.print("C");</p></p>}</p></p>}</p></p>classBase2extendsBase{</p></p>publicBase2(){</p></p>System.out.print("B");</p></p>}</p></p>}</p></p>publicclassTestDemoextendsBase2{</p></p>intm=1;</p></p>publicTestDemo(){</p></p>System.out.println("A");</p></p>}</p></p>publicstaticvoidmain(Stringargs[]){</p></p>TestDemot=newTestDemo();</p></p>}</p></p>}</p></p>
有基类如下:classBASE{private:intx,y;public:BASE(intx,inty){this->x=x;this->y=y;}voidset(intx1,inty1){x=x1;y=y1;}...};设DERIV为BASE的公有派生类,则下列哪个DERIV的构造函数对基类成员的初始化是正确的? A: DERIV(int x,inty){BASE(x,y);...} B: DERIV(intx1,inty1){x=x1;y=y1;...} C: DERIV(intx,inty):BASE(x,y){...} D: DERIV(intx,inty){set(x1,y1);...}
有基类如下:classBASE{private:intx,y;public:BASE(intx,inty){this->x=x;this->y=y;}voidset(intx1,inty1){x=x1;y=y1;}...};设DERIV为BASE的公有派生类,则下列哪个DERIV的构造函数对基类成员的初始化是正确的? A: DERIV(int x,inty){BASE(x,y);...} B: DERIV(intx1,inty1){x=x1;y=y1;...} C: DERIV(intx,inty):BASE(x,y){...} D: DERIV(intx,inty){set(x1,y1);...}