File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "wait/notify" Watch "wait/notify" New topic


enediel Gonza

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

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

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:
subject: wait/notify
jQuery in Action, 3rd edition