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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies 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)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: wait/notify
 
Similar Threads
Mock exam question
wait method calls
Runtime Time Exception
Why no compilation failure
IllegalMonitorStateException from notify()