Java Reference
In-Depth Information
A. xyzzyx
B. zyxxyz
C. Either xyzzyx or zyxxyz
D. The code generates an exception at runtime.
E. The code does not compile.
13. Given the following statements:
5. Thread t = new Thread(new Runnable() {
6. public void run() {
7. System.out.println(“do something”);
8. }
9. });
10. t.start();
what is the state of the thread t immediately after line 10 executes?
A. NEW
B. RUNNABLE
C. BLOCKED
D. TERMINATED
E. The state of the thread is indeterminate.
14. Given the following statements:
7. Thread t = new Thread(new Runnable() {
8. public void run() {
9. System.out.println(“do something”);
10. }
11. });
12. try {
13. t.sleep(1000);
14. }catch(InterruptedException e) {
15. System.out.println(e);
16. }
what is the state of the thread t immediately after line 13 executes?
A. NEW
B. RUNNABLE
C. TIMED_WAITING
D. WAITING
E. The state of the thread is indeterminate.
Search WWH ::




Custom Search