• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Threads wait() question

 
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Why at line #1 it prints 99999? shouldn't it wait() forever? Because there is no notify().
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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....

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

Henry
 
Janki Shah
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Henry.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic