网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

classTestA{publicvoidstart(){System.out.println(”TestA”);}}publicclassTestBextendsTestA{publicvoidstart(){System.out.println(”TestB”);}publicstaticvoidmain(String[]args){((TestA)newTestB()).start();}}Whatistheresult?()

A.TestA

B.TestB

C.Compilationfails.

D.Anexceptionisthrownatruntime.


参考答案

更多 “ classTestA{publicvoidstart(){System.out.println(”TestA”);}}publicclassTestBextendsTestA{publicvoidstart(){System.out.println(”TestB”);}publicstaticvoidmain(String[]args){((TestA)newTestB()).start();}}Whatistheresult?()A.TestAB.TestBC.Compilationfails.D.Anexceptionisthrownatruntime. ” 相关考题
考题 现有:classTestA{publicvoidstart(){System.out.println(TestA);}}publicclassTestBextendsTestA{publicvoidstart(){System.out.println(TestB);}publicstaticvoidmain (string[]args)(((TestA)newTestB()).start();)}运行结果是哪项?()A.TeStAB.TeStBC.编译失败D.运行时抛出异常

考题 WhichtwocodefragmentswillexecutethemethoddoStuff()inaseparatethread?() A.newThread(){publicvoidrun(){doStuff();}}B.newThread(){publicvoidstart(){doStuff();}}C.newThread(){publicvoidstart(){doStuff();}}.run();D.newThread(){publicvoidrun(){doStuff();}}.start();E.newThread(newRunnable(){publicvoidrun(){doStuff();}}).run();F.newThread(newRunnable(){publicvoidrun(){doStuff();}}).start();

考题 Whichmethodmustbedefinedbyaclassimplementingthejava.lang.Runnableinterface?() A.voidrun()B.publicvoidrun()C.publicvoidstart()D.voidrun(intpriority)E.publicvoidrun(intpriority)F.publicvoidstart(intpriority)

考题 1.classTestA{2.TestBb;3.TestA(){4.b=newTestB(this);5.}6.}7.classTestB{8.TestAa;9.TestB(TestAa){10.this.a=a;11.}12.}13.classTestAll{14.publicstaticvoidmain(Stringargs[]){15.newTestAll().makeThings();16.//...codecontinueson17.}18.voidmakeThings(){19.TestAtest=newTestA();20.}21.}Whichtwostatementsaretrueafterline15,beforemaincompletes?()

考题 以下内容在同一个源程序中: abstract class A { abstract int num(); } class TestA { public static void f(A t) { System.out.println(t.num()); } public static void main(String[] args) { f(new A() { int num() { return 20; } } ); } } 程序运行的结果是输出()。

考题 用于制造核武器的钚的同位素为()A.Pu-238B.Pu-239C.Pu-240D.Pu-241

考题 下面程序运行后的输出结果为() class A{ static int y=6; void showy(){ System.out.println("y="+y); } } class testA{ public static void main(String aaa []){ A a1 = new A(); A.y+=1; a1.y++; a1.showy(); } } 输出结果选择:A.y=6B.y=7C.y=8D.程序运行出错

考题 下面程序运行后的输出结果为() class A{ public int y=6; void showy(){ System.out.println("y="+y); } } class testA{ public static void main(String aaa []){ A a1 = new A(); A b1 = new A(); a1.y++; b1.showy(); } } 输出结果选择:A.y=6B.程序运行出错C.y=8D.y=7

考题 下面程序运行后的输出结果为() class A{ static int y=6; void showy(){ System.out.println("y="+y); } } class testA{ public static void main(String aaa []){ A a1 = new A(); A.y+=1; a1.y++; a1.showy(); } } 输出结果选择:A.y=6B.程序运行出错C.y=8D.y=7