File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes wait/notify Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply 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: 18670
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)
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: wait/notify
 
Similar Threads
Runtime Time Exception
Mock exam question
Why no compilation failure
wait method calls
IllegalMonitorStateException from notify()