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.
您可能感兴趣的试卷
你可能感兴趣的试题
Given that c is a reference to a valid java.io.Console object, and:
11.String pw = c.readPassword("%s", "pw: ");
12.System.out.println("got " + pw);
13.String name = c.readLine("%s", "name: ");
14.System.out.println(" got ", name);
If the user types fido when prompted for a password, and then responds bob when prompted for a name,what is the result?()
A.An exception is thrown at runtime
B.pw: fido got fido name: bob got bob
C.pw: got fido name: bob got bob
D.Compilation fails.
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.
Given:
12.Date date = new Date();
13.df.setLocale(Locale.ITALY);
14.String s = df.format(date);
The variable df is an object of type DateFormat that has been initialized in line 11.
What is the result if this code is run on December 14, 2000?()
A.The value of s is 14-dic-2000.
B.The value of s is Dec 14, 2000.
C.An exception is thrown at runtime.
D.Compilation fails because of an error in line 13.
Given:
What is the result?()
A.int Long
B.Short Long
C.Compilation fails.
D.An exception is thrown at runtime.
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.
Given that Triangle implements Runnable, and:
Which two statements, inserted independently at both lines 35 and 41, tend to allow both threads totemporarily pause and allow the other thread to execute?()
A.Thread.wait();
B.Thread.join();
C.Thread.yield();
D.Thread.sleep(1);
E.Thread.notify();
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
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".
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.
Given:
What is the result?()
A.Afoo Afoo
B.Afoo Bfoo
C.Bfoo Afoo
D.Bfoo Bfoo
E.Compilation fails
最新试题
Given:What is the result?()
Click the Exhibit button.Which graph represents the correct directory structure for a JAR file from which those classes can be used by the compiler and JVM?()
Given:Which command-line invocations will compile?()
Given a method that must ensure that its parameter is not null:What, inserted at line 12, is the appropriate way to handle a null value?()
Given:What is the appropriate definition of the hashCode method in class Person?()
Given:Which line of code marks the earliest point that an object referenced by intObj becomes a candidate for garbage collection?()
Given:What is the result?()
Given:When the doSomething method is called, after which line does the Object created in line 5 become available for garbage collection?()
Given:What is the result?()
Click the Exhibit button.What two must the programmer do to correct the compilation errors?()