Review Questions |
9.8 |
Which one of these events will cause a thread to die?
Select the one correct answer.
|
9.9 |
Which statements are true about the following code?
public class Joining { static Thread createThread(final int i, final Thread t1) { Thread t2 = new Thread() { public void run() { System.out.println(i+1); try { t1.join(); } catch (InterruptedException e) { } System.out.println(i+2); } }; System.out.println(i+3); t2.start(); System.out.println(i+4); return t2; } public static void main(String[] args) { createThread(10, createThread(20, Thread.currentThread())); } } Select the two correct answers.
|
9.10 |
What can be guaranteed by calling the method yield()?
Select the one correct answer.
|
9.11 |
Where is the notify() method defined?
Select the one correct answer.
|
9.12 |
How can the priority of a thread be set?
Select the one correct answer. |
9.13 |
Which statements are true about locks?
Select the two correct answers.
|
9.14 |
What will be the result of invoking the wait() method on an object without ensuring that the current thread holds the lock of the object?
Select the one correct answer.
|
9.15 |
Which of these are plausible reasons why a thread might be alive, but still not be running?
Select the four correct answers.
|