23.Object[]myObjects={24.newinteger(12),25.newString(”foo”),26.newinteger(5),27.newBoolean(true)28.};29.Arrays.sort(myObjects);30.for(inti=0;i31.System.out.print(myObjects[i].toString());32.System.out.print(”);33.}Whatistheresult?()A.Compilationfailsdueto

题目

23.Object[]myObjects={24.newinteger(12),25.newString(”foo”),26.newinteger(5),27.newBoolean(true)28.};29.Arrays.sort(myObjects);30.for(inti=0;i31.System.out.print(myObjects[i].toString());32.System.out.print(”);33.}Whatistheresult?()

A.Compilationfailsduetoanerrorinline23.

B.Compilationfailsduetoanerrorinline29.

C.AClassCastExceptionoccursinline29.

D.AClassCastExceptionoccursinline31.

E.Thevalueofallfourobjectsprintsinnaturalorder.


相似考题
更多“Object[]myObjects={24.newinteger(12),25.newString(”foo”),26.newinteger(5),27.newBoolean ”相关问题
  • 第1题:

    GivenanELfunctionfoo,innamespacefunc,thatrequiresalongasaparameterandreturnsaMap,which twoarevalidinvocationsoffunctionfoo?()

    A.${func(1)}

    B.${foo:func(4)}

    C.${func:foo(2)}

    D.${foo(5):func}

    E.${func:foo("easy")}

    F.${func:foo("3").name}


    参考答案:C, F

  • 第2题:

    publicclassTest{2.publicstaticvoidmain(Stringargs[]){3.classFoo{4.publicinti=3;5.}6.Objecto=(Object)newFoo();7.Foofoo=(Foo)o;8.System.out.printIn(foo.i);9.}10.}Whatistheresult?()

    A.Compilationwillfail.

    B.Compilationwillsucceedandtheprogramwillprint“3”

    C.CompilationwillsucceedbuttheprogramwillthrowaClassCastExceptionatline6.

    D.CompilationwillsucceedbuttheprogramwillthrowaClassCastExceptionatline7.


    参考答案:B

  • 第3题:

    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.


    参考答案:B

  • 第4题:

    fooandbararepublicreferencesavailabletomanyotherthreads.fooreferstoaThreadandbarisanObject.Thethreadfooiscurrentlyexecutingbar.wait().Fromanotherthread,whichstatementisthemostreliablewaytoensuethatfoowillstopexecutingwait()?

    A.foo.notify();

    B.bar.notify();

    C.foo.notifyAll();

    D.Thread.notify();

    E.bar.notiFYAll();

    F.Object.notify();


    参考答案:E

  • 第5题:

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

    A.i=3

    B.Compilationfails.

    C.AClassCastExceptionisthrownatline6.

    D.AClassCastExceptionisthrownatline7.


    参考答案:A