10.interfaceFoo{intbar();}11.publicclassSprite{12.publicintfubar(Foofoo){returnfoo.bar();}13.publicvoidtestFoo(){14.fubar(15.//insertcodehere16.);17.}18.}Whichcode,insertedatline15,allowstheclassSpritetocompile?()A.Foo{publicintbar(){return1;}}B.newFoo{publicintbar(){return1;}}C.newFoo(){publicintbar(){return1;}}D.newclassFoo{publicintbar(){return1;}}

10.interfaceFoo{intbar();}11.publicclassSprite{12.publicintfubar(Foofoo){returnfoo.bar();}13.publicvoidtestFoo(){14.fubar(15.//insertcodehere16.);17.}18.}Whichcode,insertedatline15,allowstheclassSpritetocompile?()

A.Foo{publicintbar(){return1;}}

B.newFoo{publicintbar(){return1;}}

C.newFoo(){publicintbar(){return1;}}

D.newclassFoo{publicintbar(){return1;}}


相关考题:

classFoo{privateintx;publicFoo(intx){this.x=x;}publicvoidsetX(intx){this.x=x;}publicintgetX(){returnx;}}publicclassGamma{staticFoofooBar(Foofoo){foo=newFoo(100);returnfoo;}publicstaticvoidmain(String[]args){Foofoo=newFoo(300);System.out.print(foo.getX()+-);FoofooFoo=fooBar(foo);System.out.print(foo.getX()+-);System.out.print(fooFoo.getX()+-);foo=fooBar(fooFoo);System.out.print(foo.getX()+-);System.out.prmt(fooFoo.getX());}}Whatistheoutputofthisprogram?()

interfaceFoo{11.intbar();12.&ensp 10.interfaceFoo{11.intbar();12.}13.14.publicclassBeta{15.16.classAimplementsFoo{17.publicintbar(){return1;}18.}19.20.publicintfubar(Foofoo){returnfoo.bar();}21.22.publicvoidtestFoo(){23.24.classAimplementsFoo{25.publicintbar(){return2;}26.}27.28.System.out.println(fubar(newA()));29.}30.31.publicstaticvoidmain(String[]argv){32.newBeta().testFoo();33.}34.}Whichthreestatementsaretrue?()

intindex=1;int[]foo=newint[3];intbar=foo[index];intbaz=bar+index;Whatistheresult?() A.Bazhasthevalueof0B.Bazhasthevalueof1C.Bazhasthevalueof2D.Anexceptionisthrown.E.Thecodewillnotcompile.

publicclassTest{publicstaticvoidmain(Stringargs[]){classFoo{publicinti=3;}Objecto=(Object)newFoo();Foofoo=(Foo)o;System.out.println(i=+foo.i);}}Whatistheresult?() A.i=3B.Compilationfails.C.AClassCastExceptionisthrownatline6.D.AClassCastExceptionisthrownatline7.

publicclassTest{publicstaticvoidmain(Stringargs){classFoo{publicinti=3;}Objecto=(Object)newFoo();Foofoo=(Foo)o;System.out.printIn(foo.i);}}Whatistheresult?() A.Compilationwillfail.B.Compilationwillsucceedandtheprogramwillprint“3”C.CompilationwillsucceedbuttheprogramwillthrowaClassCastExceptionatline6.D.CompilationwillsucceedbuttheprogramwillthrowaClassCastExceptionatline7.

intindex=1;intfoo=newint;intbar=foo[index];intbaz=bar+index;Whatistheresult?() A.Bazhasthevalueof0B.Bazhasthevalueof1C.Bazhasthevalueof2D.Anexceptionisthrown.E.Thecodewillnotcompile.

有如下类声明: class Foo{ int bar; }; 则Foo类的成员bar是A.公有数据成员B.公有成员函数C.私有数据成员D.私有成员函数

有如下类声明: class Foo {int bar;}; 则Foo类的成员bar是( )A.公有数据成员B.公有成员函数C.私有数据成员D.私有成员函数

下列程序执行后,baz的值应是 int index=1; int fox[ ]=new int[3]; Int bar=fox[index]; int baz:bar+index;A.0B.1C.2D.编译错误