更多“intindex=1;String[]test=newString[3];Stringfoo=test[index];Whatistheresult?() ”相关问题
  • 第1题:

    intindex=1;boolean[]test=newBoolean[3];booleanfoo=test[index];Whatistheresult?()

    A.Foohasthevalueof0.

    B.Foohasthevalueofnull.

    C.Foohasthevalueoftrue.

    D.Foohasthevalueoffalse.

    E.Anexceptionisthrown.

    F.Thecodewillnotcompile.


    参考答案:D

  • 第2题:

    intindex=1;intfoo=newint;intbar=foo[index];intbaz=bar+index;Whatistheresult?()

    A.Bazhasthevalueof0

    B.Bazhasthevalueof1

    C.Bazhasthevalueof2

    D.Anexceptionisthrown.

    E.Thecodewillnotcompile.


    参考答案:B

  • 第3题:

    设有以下程序,其运行输出结果为? class Test{ Test(int i) { System.out.println("Test(" +i +")"); } } public class Q12 { static Test t1 = new Test(1); Test t2 = new Test(2); static Test t3 = new Test(3); public static void main(String[ ] args){ Q12 Q = new Q12(); } }

    A.Test(1) Test(2) Test(3)

    B.Test(3) Test(2) Test(1)

    C.Test(2) Test(1) Test(3)

    D.Test(1) Test(3) Test(2)


    7

  • 第4题:

    intindex=1;Stringtest=newString;Stringfoo=test[index];Whatistheresult?()

    A. Foohasthevalue“”

    B.Foohasthevaluenull

    C.Anexceptionisthrown

    D.Thecodewillnotcompile


    参考答案:B

  • 第5题:

    Given:11.Stringtest="a1b2c3";12.String[]tokens=test.split("\\d");13.for(Strings:tokens)System.out.print(s+"");Whatistheresult?()

    A.abc

    B.123

    C.a1b2c3

    D.a1b2c3


    参考答案:A