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

题目内容 (请给出正确答案)
publicclassA{2.voidA(){3.System.out.println(ClassA”);4.}5.publicstaticvoidmain(String[]args){6.newA();7.}8.}Whatistheresult?()

A.ClassA

B.Compilationfails.

C.Anexceptionisthrownatline2.

D.Anexceptionisthrownatline6.

E.Thecodeexecuteswithnooutput.


参考答案

更多 “ publicclassA{2.voidA(){3.System.out.println(ClassA”);4.}5.publicstaticvoidmain(String[]args){6.newA();7.}8.}Whatistheresult?() A.ClassAB.Compilationfails.C.Anexceptionisthrownatline2.D.Anexceptionisthrownatline6.E.Thecodeexecuteswithnooutput. ” 相关考题
考题 class A{public int getNumber(int a){return a+1;}}class B extends A{public int getNumber(int a, char c){return a+2;}public static void main(String[] args){B b=new B();System.out.println(b.getNumber(0));}}what is the result?()A.compilation succeeds and 1 is printedB.compilation succeeds and 2 is printedC.compilation succeeds and 3 is printedD.An error at this program cause compilation to fail

考题 下列语句输出结果为 。public class A{public static void main(String[]args){byte b=0xa;System.out.println(b);}}() A.0xaB.aC.1D.10

考题 publicstaticvoidmain(String[]args){try{args=null;args[0]=test”;System.out.println(args[0]);}catch(Exceptionex){System.out.println(”Exception”);}catch(NullPointerExceptionnpe){System.out.println(”NullPointerException”);}}Whatistheresult?()A.testB.ExceptionC.Compilationfails.D.NullPointerException

考题 interfaceTestA{StringtoString();}2.publicclassTest{3.publicstaticvoidmain(String[]args){4.System.out.println(newTestA(){5.publicStringtoString(){returntest”;}6.}7.}8.}Whatistheresult?() A.testB.nullC.Anexceptionisthrownatruntime.D.Compilationfailsbecauseofanerrorinline1.E.Compilationfailsbecauseofanerrorinline4.F.Compilationfailsbecauseofanerrorinline5.

考题 1.classA{2.publicStringtoString(){3.return4”;4.}5.}6.classBextendsA{7.publicStringtoString(){8.returnsuper.toString()+3”;9.}10.}11.publicclassTest{12.publicstaticvoidmain(String[]args){13.System.out.printIn(newB());14.}15.}Whatistheresult?()A.Compilationsucceedsand4isprinted.B.Compilationsucceedsand43isprinted.C.Anerroronline9causescompilationtofail.D.Anerroronline14causescompilationtofail.E.Compilationsucceedsbutanexceptionisthrownatline9.

考题 publicclassFooimplementsRunnable(3.publicvoidrun(Threadt){4.system.out.printIn(Running.”);5.}6.publicstaticvoidmain(String[]args){7.newthread(newFoo()).start();8.)9.)Whatistheresult?() A.Anexceptionisthrown.B.Theprogramexistswithoutprintinganything.C.Anerroratline1causescompilationtofail.D.Anerroratline6causesthecompilationtofail.E.“Running”isprintedandtheprogramexits.

考题 publicclassArrayTest{2.publicstaticvoidmain(String[]args){3.floatf1[],f2[];4.f1=newfloat[10];5.f2=f1;6.System.out.printIn(f2[0]=”+f2[0]);7.}8.}Whatistheresult?() A.Itprintsf2[0]=0.0B.Itprintsf2[0]=NaNC.Anerroratline5causescompiletofail.D.Anerroratline6causescompiletofail.E.Anerroratline6causesanexceptionatruntime.

考题 1.publicclassenclosingone(2.publicclassinsideone{}3.)4.publicclassinertest(5.publicstaticvoidmain(string[]args)(6.enclosingoneeo=newenclosingone();7.//insertcodehere8.)9.)Whichstatementatline7constructsaninstanceoftheinnerclass?()A.InsideOnewei=eo.newInsideOn();B.Eo.InsideOneei=eo.newInsideOne();C.InsideOneei=EnclosingOne.newInsideOne();D.EnclosingOne.InsideOneei=eo.newInsideOne();

考题 publicclassTest{publicstaticvoidmain(String[]args){Stringstr=NULL;System.out.println(str);}}Whatistheresult?() A.NULLB.Compilationfails.C.Thecoderunswithnooutput.D.Anexceptionisthrownatruntime.