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
Click the Exhibit button.
Which three statements are true?()
A.Compilation fails.
B.The code compiles and the output is 2.
C.If lines 16, 17 and 18 were removed, compilation would fail.
D.If lines 24, 25 and 26 were removed, compilation would fail.
E.If lines 16, 17 and 18 were removed, the code would compile and the output would be 2.
F.If lines 24, 25 and 26 were removed, the code would compile and the output would be 1.
Given:
What is the result?()
A.Compilation succeeds.
B.Compilation fails due to multiple errors.
C.Compilation fails due to an error only on line 20.
D.Compilation fails due to an error only on line 21.
E.Compilation fails due to an error only on line 22.
Click the Exhibit button.
What is the result?()
A.go in Goban go in Sente go in Sente
B.go in Sente go in Sente go in Goban
C.go in Sente go in Goban go in Goban
D.go in Goban go in Goban go in Sente
Given:
Which statement is true?()
A.The code will compile without changes.
B.The code will compile if public Tree() { Plant(); } is added to the Tree class.
C.The code will compile if public Plant() { Tree(); } is added to the Plant class.
D.The code will compile if public Plant() { this("fern"); } is added to the Plant class.
E.The code will compile if public Plant() { Plant("fern"); } is added to the Plant class.
A.static final int[] a = { 100,200 };
B.static final int[] a; static { a=new int[2]; a[0]=100; a[1]=200; }
C.static final int[] a = new int[2]{ 100,200 };
D.static final int[] a; static void init() { a = new int[3]; a[0]=100; a[1]=200; }
最新试题
Click the Exhibit buttonWhich two statements are true if a NullPointerException is thrown on line 3 of class C?()
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?()
Click the Exhibit button.What two must the programmer do to correct the compilation errors?()
Given:What is the result?()
Click the Exhibit button.What is the result?()
Given:What is the result?()
Given:What is the result?()
Given:What is the result?()
Given:What is the appropriate definition of the hashCode method in class Person?()