Welcome Guest | Sign in | Register
Threads - Discussion Page For Q.2961 | Java Programming Questions and Answers | Java Programming Free Online-Tests | LucentBlackBoard | LucentBlackBoard.com

Home > Java Programming > Threads > Questions and Answers

Q: 1. class A implements Runnable {
2. int I;
3. public void run () {
4. try {
5. Thread.sleep(5000);
6. i=10;
7. }catch(InterruptedException e) {}
8. }
9. }
10.
11. public class Test {
12. public static void main (String args[]) {
13. try {
14. A a = new A();
15. Thread t = new Thread(a);
16. t.start();
17.
18. int j= a.i;
19.
20. }catch (Exception e) {}
21. }
22. }

Which statement at line 17 will ensure that j=10 at line 19 
A. a.wait() B. t.wait()
C. t.join() D. t.yield()

Answer and Explanation

Answer:t.join()

Explanation:
There is no explanation...

Comment on this Question

Name:

Loading...




Partner Sites
LucentBlackBoard.com                  SoftLucent.com                  LucentJobs.com
All rights reserved © 2012-2015 SoftLucent.