This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Threads wait() question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Threads wait() question" Watch "Threads wait() question" New topic
Author

Threads wait() question

Janki Shah
Ranch Hand

Joined: Nov 23, 2011
Posts: 136

Why at line #1 it prints 99999? shouldn't it wait() forever? Because there is no notify().
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18101
    
  39

Janki Shah wrote:
Why at line #1 it prints 99999? shouldn't it wait() forever? Because there is no notify().



This question, or question related to the same issue actually comes up often....

http://www.coderanch.com/t/565836/java-programmer-SCJP/certification/Misunderstanding-wait-method
http://www.coderanch.com/t/546560/java-programmer-SCJP/certification/Notify-notifyAll
http://www.coderanch.com/t/490052/java-programmer-SCJP/certification/wait-notify-test
http://www.coderanch.com/t/489800/java-programmer-SCJP/certification/Confusing-wait-notify
http://www.coderanch.com/t/487066/threads/java/wait-notify-notifyAll

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Janki Shah
Ranch Hand

Joined: Nov 23, 2011
Posts: 136
Thank you Henry.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Threads wait() question
 
Similar Threads
Thread question
another question from nikos
Simple Thread Program : Need Clarification
Misunderstanding with the wait() method.
Problem in Threading - 2