classTestSuper{22.TestSuper(inti){}3.}4.classTestSubextendsTestSuper{}5.classTestAll{6.publicstaticvoidmain(String[]args){7.newTestSub();8.}9.}Whichistrue?() A.Compilationfails.B.Thecoderunswithoutexception.C.Anexceptionisthrownatline7.D.Anexceptionisthrownatline2.

classTestSuper{22.TestSuper(inti){}3.}4.classTestSubextendsTestSuper{}5.classTestAll{6.publicstaticvoidmain(String[]args){7.newTestSub();8.}9.}Whichistrue?()

A.Compilationfails.

B.Thecoderunswithoutexception.

C.Anexceptionisthrownatline7.

D.Anexceptionisthrownatline2.


相关考题:

下列程序段运行的结果为 public class Test{ static void print(String s,int i){ System.out.println("String:"+s+",int:"+i); } static void print(int i,String s){ System.out.println("int:"+i+",String:"+s); } public static void main(String[]args){ print(99,"Int first"); } }A.String:String first,int:11B.int:11,String:Int firstC.String:String first,int99D.int:99,String:Int first

现有:3.importjava.util.*;4.classForInTest{5.staticListlist=newArrayList();6.publicstaticvoidmain(String[]args){7.8.list.add(a);list.add(b);list.add(c);9.//insertcodehere10.System.out.print(o);}}哪一行插入到第9行将导致输出abc”?()A.for(Objecto:list)B.for(Iteratoro:list)C.for(Objecto:list.iterator())D.for(Iteratoro:list.iterator();o.hasNext();)

classClassA{publicintnumberOfinstances;protectedClassA(intnumberOfinstances){this.numberOflnstances=numberOfinstances;}}publicclassExtendedAextendsClassA{privateExtendedA(intnumberOfinstances){super(numberOflnstances);}publicstaticvoidmain(String[]args){ExtendedAext=newExtendedA(420);System.out.print(ext.numberOflnstances);}}Whichistrue?()A.420istheoutput.B.Anexceptionisthrownatruntime.C.Allconstructorsmustbedeclaredpublic.D.ConstructorsCANNOTusetheprivatemodifier.E.ConstructorsCANNOTusetheprotectedmodifier.

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.

publicclassAlpha{privatestaticCharacter()ids;publicstaticvoidmain(String[]args){ids=newCharacter[args.length];for(inti=0;iids[i]=newCharacter(args[i]);System.out.print(ids[i]);}}}Whatiscorrect?() A.Compilationfails.B.Thecoderunswithnooutput.C.Anexceptionisthrownatruntime.D.Thecoderuns,outputingaconcatenatedlistoftheargumentspassedtotheprogram.

publicclassOuter{2.publicvoidsomeOuterMethod(){3.//Line34.}5.publicclassInner{}6.publicstaticvoidmain(String[]argv){7.Outero=newOuter();8.//Line89. }10. }WhichinstantiatesaninstanceofInner?() A.newInner();//Atline3B.newInner();//Atline8C.newo.Inner();//Atline8D.newOuter.Inner();//Atline8

下列程序段运行的结果为 public class Test{ static void print(String s,int i){ System.out.println("String:"+s+",int:"+i); } static void print(int i, String s){ System.out.println("int:"+i+",String:"+s); } public static void main(String [] args){ print(99,"Int first"); } }A.String:Stringfirst,int:11B.int:11,String:Int firstC.String:String first,int:99D.int:99,String:int first

以下哪个main方法是正确的?A.public static void main(string[] args)B.public static void Main(String[] args)C.public static void main(String[] args)D.public static main(String[] args)E.public void main(String[] args)

main()方法的正确定义方式是()。A.public static void main (String [ ] args ) { new NameSurfer().start (args ) ; }B.public static main (String [ ] args ) { new NameSurfer().start (args ) ; }C.public void main (String [ ] args ) { new NameSurfer().start (args ) ; }D.public static void main (String [ ] args ) { NameSurfer().start (args ) ; }