• Post Reply Bookmark Topic Watch Topic
  • New Topic

wait method calls  RSS feed

 
vijay ks
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> Why we are calling wait and notify methods from a
> synchronized block, what will happen if it is called
> from a non -synch method.
> pls reply .
 
Peter Chase
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is illegal to call wait() or notify() unless holding the monitor of the object on which you are calling them. You'll get a runtime exception.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!