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”


相关考题:

publicclassBase{publicstaticfinalStringFOO=foo”;publicstaticvoidmain(String[]args){Baseb=newBase();Subs=newSub();System.out.print(Base.FOO);System.out.print(Sub.FOO);System.out.print(b.FOO);System.out.print(s.FOO);System.out.print(((Base)s).FOO);}}classSubextendsBase{publicstaticfinalStringFOO=bar;}Whatistheresult?()A.foofoofoofoofooB.foobarfoobarbarC.foobarfoofoofooD.foobarfoobarfooE.barbarbarbarbarF.foofoofoobarbarG.foofoofoobarfoo

Stringfoo=blue”;Boolean[]bar=newBoolean[1];if(bar[0]){foo=green”;}Whatistheresult?() A.Foohasthevalueof“”B.Foohasthevalueofnull.C.Foohasthevalueof“blue”D.Foohasthevalueof“green”E.Anexceptionisthrown.F.Thecodewillnotcompile.

publicclassTest{publicstaticvoidmain(String[]args){Stringfoo=args[1];Stringbar=args[2];Stringbaz=args[3];System.out.printIn(baz=”+baz);}}Andtheoutput:Baz=2Whichcommandlineinvocationwillproducetheoutput?()A.JavaTest2222B.JavaTest1234C.JavaTest4242D.JavaTest4321

publicclasstest(publicstaticvoidmain(string[]args){stringfoo=args[1];stringfoo=args[2];stringfoo=args[3];})Andcommandlineinvocation:JavaTestredgreenblueWhatistheresult?() A.Bazhasthevalueof“”B.BazhasthevalueofnullC.Bazhasthevalueof“red”D.Bazhasthevalueof“blue”E.Baxhasthevalueof“green”F.Theprogramthrowsanexception.

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”

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.

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.

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

publicclasstest(publicstaticvoidmain(stringargs){stringfoo=args[1];stringfoo=args;stringfoo=args;})Andcommandlineinvocation:JavaTestredgreenblueWhatistheresult?() A.Bazhasthevalueof“”B.BazhasthevalueofnullC.Bazhasthevalueof“red”D.Bazhasthevalueof“blue”E.Baxhasthevalueof“green”F.Theprogramthrowsanexception.