This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes wait/notify Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "wait/notify" Watch "wait/notify" New topic
Author

wait/notify

enediel Gonza
Greenhorn

Joined: Jun 11, 2005
Posts: 4
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

Joined: Jan 30, 2000
Posts: 18671
No. It's only at runtime that this error is detected.


"I'm not back." - Bill Harding, Twister
Wensheng Li
Greenhorn

Joined: Jul 08, 2005
Posts: 16
Yes,it throws an exception at runtime:
java.lang.IllegalMonitorStateException: current thread not owner


SCWCD 1.4(In progress)<br />SCJP 5.0<br />IBM Certified Solutions Expert for Webshpere Studio, V3.5 (retired)
 
 
subject: wait/notify