aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Threads 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 "Threads" Watch "Threads" New topic
Author

Threads

Puja S
Ranch Hand

Joined: Jan 06, 2005
Posts: 51
Hi,

If Object.wait( ) method is called from a synchronized method,then the current thread will move to the waiting state until some other thread invokes the notify ( ) or notifyAll ( ) method on this object.

Can any body tell me that when the thread moves to the waiting state,will it release the lock ?

Thanks.
Dave Wood
bronco
Ranch Hand

Joined: Aug 02, 2004
Posts: 161
Yes!

(if it didn't, no other thread could call notify...because you have to have the lock to call those methods)

Remember, javadoc is your friend!
[ January 06, 2005: Message edited by: Dave Wood ]

Co-Author of <a href="http://www.oreilly.com/catalog/jswing2" target="_blank" rel="nofollow">Java Swing</a><br />Co-Creator of <a href="http://www.sun.com/training/catalog/courses/CX-310-055.xml" target="_blank" rel="nofollow">SCJP 5.0</a> and <a href="http://www.sun.com/training/certification/java/associate_beta.xml" target="_blank" rel="nofollow">SCJA</a> exams
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
"Puja" welcome to JavaRanch. Please read our JavaRanch Naming Policy and change your displayed name to conform with it. We require a <first name> <family name> format, preferably your real names.
Thanks
-Barry


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Threads