*
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 Android Security Essentials Live Lessons this week in the Android 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: 18546
    
  40

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.
 
Don't get me started about those stupid light bulbs.
 
subject: Threads wait() question
 
Similar Threads
another question from nikos
Misunderstanding with the wait() method.
Simple Thread Program : Need Clarification
Thread question
Problem in Threading - 2