publicclassTest{publicstaticvoidmain(String[]args){stringfoo=blue”;stringbar=foo;foo=green”;System.out.printIn(bar);}}Whatistheresult?()A.Anexceptionisthrown.B.Thecodewillnotcompile.C.Theprogramprints“null”D.Theprogramprints“blue”E.Theprogramprints“green”

题目
publicclassTest{publicstaticvoidmain(String[]args){stringfoo=blue”;stringbar=foo;foo=green”;System.out.printIn(bar);}}Whatistheresult?()

A.Anexceptionisthrown.

B.Thecodewillnotcompile.

C.Theprogramprints“null”

D.Theprogramprints“blue”

E.Theprogramprints“green”


相似考题
更多“publicclassTest{publicstaticvoidmain(String[]args){stringfoo=blue”;stringbar=foo;foo=green”;System.out.printIn(bar);}}Whatistheresult?() ”相关问题
  • 第1题:

    publicclassTest{publicstaticvoidmain(Stringargs){stringfoo=blue”;stringbar=foo;foo=green”;System.out.printIn(bar);}}Whatistheresult?()

    A.Anexceptionisthrown.

    B.Thecodewillnotcompile.

    C.Theprogramprints“null”

    D.Theprogramprints“blue”

    E.Theprogramprints“green”


    参考答案:D

  • 第2题:

    Stringfoo=blue”;Booleanbar=newBoolean[1];if(bar[0]){foo=green”;}Whatistheresult?()

    A.Foohasthevalueof“”

    B.Foohasthevalueofnull.

    C.Foohasthevalueof“blue”

    D.Foohasthevalueof“green”

    E.Anexceptionisthrown.

    F.Thecodewillnotcompile.


    参考答案:F

  • 第3题:

    publicclasstest(publicstaticvoidmain(stringargs){stringfoo=args[1];stringfoo=args;stringfoo=args;})Andcommandlineinvocation:JavaTestredgreenblueWhatistheresult?()

    A.Bazhasthevalueof“”

    B.Bazhasthevalueofnull

    C.Bazhasthevalueof“red”

    D.Bazhasthevalueof“blue”

    E.Baxhasthevalueof“green”

    F.Theprogramthrowsanexception.


    参考答案:F

  • 第4题:

    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

  • 第5题:

    publicclassTest{publicstaticvoidmain(Stringargs){Stringfoo=args[1];Stringbar=args;Stringbaz=args;System.out.printIn(baz=”+baz);}}Andtheoutput:Baz=2Whichcommandlineinvocationwillproducetheoutput?()

    A.JavaTest2222

    B.JavaTest1234

    C.JavaTest4242

    D.JavaTest4321


    参考答案:C