aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes S&B 1.5 Chapter 9, question 10 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "S&B 1.5 Chapter 9, question 10" Watch "S&B 1.5 Chapter 9, question 10" New topic
Author

S&B 1.5 Chapter 9, question 10

David Wooddall-Gainey
Greenhorn

Joined: Dec 13, 2007
Posts: 16
Assume the following method is properly synchronized and called from a Thread A on an Object B
wait(2000);

After calling this method, when will the Thread A become a candidate to get another turn at the CPU?

A. After object B is notified or after two seconds.
B. After the lock on B is released or after two seconde.
C. Two seconds after object B is notified
D. Two seconds after lock B is released.

A is correct: Either event will make the thread a candidate to get another turn at the CPU

Question I thought Threads were notified � not objects

Thanks
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 19073
    
  40

Question I thought Threads were notified � not objects


I guess it is just a "wording" issue. Threads are notified, and I think is it safe to assume that "object B is notified" meant thread A is notified via a call to the notify() method of object B.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
David Wooddall-Gainey
Greenhorn

Joined: Dec 13, 2007
Posts: 16
Henry,

Thanks again. Yes I thought it was wording. Sometimes it is tricky knowing when the issue is wording vs substance!

Thanks again!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: S&B 1.5 Chapter 9, question 10