Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

wait/notify

 
enediel Gonza
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
regarding this expression:
Runtime error
"A call to wait/notify must be within synchronized code. It will throw an error message ..."

My question :
?Under any circunstances the compiler detects this problem to produce a compiling error instead of a runtime error?

Thanks in advance for the answers
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. It's only at runtime that this error is detected.
 
Wensheng Li
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes,it throws an exception at runtime:
java.lang.IllegalMonitorStateException: current thread not owner
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic