单项选择题

Given:
11.String test = "This is a test";
12.String[] tokens = test.split("\s");
13.System.out.println(tokens.length);
What is the result?()

A.0
B.1
C.4
D.Compilation fails.


您可能感兴趣的试卷

你可能感兴趣的试题

2.多项选择题Which two scenarios are NOT safe to replace a StringBuffer object with a StringBuilder object?()

A.When using versions of Java technology earlier than 5.0.
B.When sharing a StringBuffer among multiple threads.
C.When using the java.io class StringBufferInputStream.
D.When you plan to reuse the StringBuffer to build more than one string.

4.单项选择题

Given:

What is the result?()

A.int Long
B.Short Long
C.Compilation fails.
D.An exception is thrown at runtime.

5.单项选择题

Given:

Which statement is true?()

A.Compilation fails.
B.An exception is thrown at runtime.
C.Synchronizing the run() method would make the class thread-safe.
D.The data in variable "x" are protected from concurrent access problems.
E.Declaring the doThings() method as static would make the class thread-safe.

7.多项选择题

Given:

Which three changes should be made to adapt this class to be used safely by multiple threads?()

A.declare reset() using the synchronized keyword
B.declare getName() using the synchronized keyword
C.declare getCount() using the synchronized keyword
D.declare the constructor using the synchronized keyword
E.declare increment() using the synchronized keyword

8.单项选择题

Given:

What is the result?()

A.Compilation fails.
B.An exception is thrown at runtime.
C.The code executes and prints "running".
D.The code executes and prints "runningrunning".
E.The code executes and prints "runningrunningrunning".

9.单项选择题

Given:

What is the result?()

A.Compilation fails.
B.An exception is thrown at runtime.
C.The code executes normally and prints "sleep".
D.The code executes normally, but nothing is printed.

10.单项选择题

Given:

What is the result?()

A.Afoo Afoo
B.Afoo Bfoo
C.Bfoo Afoo
D.Bfoo Bfoo
E.Compilation fails