niusouti.com

Stringtest=Thisisatest”;12.String[]tokens=test.split(”\s”);13.System.out.println(tokens.length);Whatistheresult?()A.0B.1C.4D.Compilationfails.E.Anexceptionisthrownatruntime.

题目
Stringtest=Thisisatest”;12.String[]tokens=test.split(”\s”);13.System.out.println(tokens.length);Whatistheresult?()

A.0

B.1

C.4

D.Compilationfails.

E.Anexceptionisthrownatruntime.


相似考题
更多“Stringtest=Thisisatest”;12.String[]tokens=test.split(”\s”);13.System.out.println(tokens.length);Whatistheresult?() ”相关问题
  • 第1题:

    publicclassfoo{publicstaticvoidmain(Stringargs){Strings;system.out.printIn(s=”+s);}}Whatistheresult?()

    A.Thecodecompilesand“s=”isprinted.

    B.Thecodecompilesand“s=null”isprinted.

    C.Thecodedoesnotcompilebecausestringsisnotinitialized.

    D.Thecodedoesnotcompilebecausestringscannotbereferenced.

    E.Thecodecompiles,butaNullPointerExceptionisthrownwhentoStringiscalled.


    参考答案:C

  • 第2题:

    Given:11.Stringtest="Thisisatest";12.String[]tokens=test.split("\s");13.System.out.println(tokens.length);Whatistheresult?()

    A.0

    B.1

    C.4

    D.Compilationfails.


    参考答案:D

  • 第3题:

    Given:11.Stringtest="TestA.TestB.TestC.";12.//insertcodehere13.String[]result=test.split(regex);Whichregularexpression,insertedatline12,correctlysplitstestinto"TestA","TestB",and"TestC"?()

    A.Stringregex="";

    B.Stringregex="";

    C.Stringregex=".*";

    D.Stringregex="\\s";

    E.Stringregex="\\.\\s*";


    参考答案:E

  • 第4题:

    Given:11.Stringtest="Thisisatest";12.String[]tokens=test.split("\s");13.System.out.println(tokens.length);Whatistheresult?()

    A.Anexceptionisthrownatruntime.

    B.1

    C.4

    D.Compilationfails.

    E.0


    参考答案:D

  • 第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