aspose file tools*
The moose likes Mock Exam Errata and the fly likes notify() in threads Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Mock Exam Errata
Bookmark "notify() in threads" Watch "notify() in threads" New topic
Author

notify() in threads

madhuri vl
Ranch Hand

Joined: Jan 17, 2001
Posts: 86
Hi ,
Here is a Q from a mock exam
Which of the following are true.
1) notify() is in Thread class.
2) notify() is a synchronized method.
3) notify() puts a thread from lock state to waiting .
OF these which are true. I know that notify(), notifyall() and wait() are the methods of Object class. Also notify() is a native method.
Can any body please give an answer for this.
Thanks in advance.


madhuri.
Wong KK
Ranch Hand

Joined: Jan 15, 2001
Posts: 52
1) notify() is in Thread class.
2) notify() is a synchronized method.
3) notify() puts a thread from lock state to waiting .
None of them is true.
notify() is a method defined in Object. (Although you may argue that Thread has inherited this method)
notify is not a synchronized method. (It just must be run in a synchronized method)
notify puts a thread from waiting to ready. (If it can acquire the lock, else it will go to block state)
madhuri vl
Ranch Hand

Joined: Jan 17, 2001
Posts: 86
Hi wong,
Thankyou very much. Can you please clear one more .
The methods of thread class are run(), start() ,getpriority()
right.
bill bozeman
Ranch Hand

Joined: Jun 30, 2000
Posts: 1070
Check out the API for all the methods of the thread class. The ones you mentioned are methods of the thread class but there are a whole lot more methods also.
Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: notify() in threads