The method waitforId() in class MediaTracker is called.
The run() method that the thread is executing ends.
The call to the start() method of the Thread object returns.
The suspend() method is called on the Thread object.
The wait() method is called on the Thread object.
第1题:
Which two code fragments will execute the method doStuff() in a separate thread?()
第2题:
What happens when thread X executes a wait() method on object A, without owning object A’s lock?()
第3题:
Which method in the Thread class is used to create and launch a new thread of execution?()
第4题:
Which two can be used to create a new Thread?()
第5题:
Which statement is true?()
第6题:
Which two code fragments will execute the method doStuff() in a separate thread?()
第7题:
Compilation fails.
An exception is thrown at runtime.
Synchronizing the run() method would make the class thread-safe.
The data in variable “x” are protected from concurrent access problems.
Declaring the doThings() method as static would make the class thread-safe.
Wrapping the statements within doThings() in a synchronized(new Object()) {} block would make the class thread-safe.
第8题:
Exiting from a synchronized block.
Calling the wait method on an object.
Calling the notify method on an object.
Calling the notifyAll method on an object.
Calling the setPriority method on a thread object.
第9题:
Instances of class Thread have a method called notify().
A call to the method notify() will wake the thread that currently owns the monitor of the object.
The method notify() is synchronized.
The method notifyAll() is defined in class Thread.
When there is more than one thread waiting to obtain the monitor of an object, there is no way to be sure which thread will be notified by the notify() method.
第10题:
If only one thread is blocked in the wait method of an object, and another thread executes the modify on that same object, then the first thread immediately resumes execution.
If a thread is blocked in the wait method of an object, and another thread executes the notify method on the same object, it is still possible that the first thread might never resume execution.
If a thread is blocked in the wait method of an object, and another thread executes the notify method on the same object, then the first thread definitely resumes execution as a direct and sole consequence of the notify call.
If two threads are blocked in the wait method of one object, and another thread executes the notify method on the same object, then the first thread that executed the wait call first definitely resumes execution as a direct and sole consequence of the notify call.
第11题:
 Run();
 Start();
 Execute();
 Run(Runnable r);
 Start(Runnable r);
 Execute(Thread t);
第12题:
Compilation fails.
An exception is thrown.
The wait() method has no effect.
Thread X receives the lock immediately.
Object A moves the thread to the wait pool.
第13题:
Under which circumstances will a thread stop?()
第14题:
Given that t1 is a reference to a live thread, which is true?()
第15题:
Which two can directly cause a thread to stop executing?()
第16题:
public class TestSeven extends Thread { private static int x; public synchronized void doThings() { int current = x; current++; x = current; } public void run() { doThings(); } } Which is true?()
第17题:
Which two CANNOT directly cause a thread to stop executing? ()
第18题:
You are creating a Windows application for graphical image processing by using the .NET Framework 3.5. You create an image processing function and a delegate.You plan to invoke the image processing function by using the delegate.You need to ensure that the calling thread meets the following requirements: (1)It is not blocked when the delegate is running (2)It is notified when the delegate is complete What should you do?()
第19题:
The method waitforId() in class MediaTracker is called.
The run() method that the thread is executing ends.
The call to the start() method of the Thread object returns.
The suspend() method is called on the Thread object.
The wait() method is called on the Thread object.
第20题:
Calling the yield method.
Calling the wait method on an object.
Calling the notify method on an object.
Calling the notifyAll method on an object.
Calling the start method on another Thread object.
第21题:
Extend java.lang.Thread and override the run method.
Extend java.lang.Runnable and override the start method.
Implement java.lang.thread and implement the run method.
Implement java.lang.Runnable and implement the run method.
Implement java.lang.Thread and implement the start method.
第22题:
public void DoWork();
public void DoWork(int nCounter);
public void DoWork(object oCounter);
public void DoWork(Delegate oCounter);
第23题:
new Thread() {public void run() { doStuff(); }};
new Thread() {public void start() { doStuff(); }};
new Thread() {public void start() { doStuff(); }}.run();
new Thread() {public void run() { doStuff(); }}.start();
new Thread(new Runnable() {public void run() { doStuff(); }}).start();
第24题:
The Thread.sleep() method can take t1 as an argument.
The Object.notify() method can take t1 as an argument.
The Thread.yield() method can take t1 as an argument.
The Thread.setPriority() method can take t1 as an argument.
The Object.notify() method arbitrarily chooses which thread to notify.