IllegalMonitorStateException? wait() and notify()

Can someone tell me what's the deal with wait() and notify() methods? Like how to use them properly? Right now I have two threads, one being the main program and the other should run occationally when I need it... I try to get the second to wait() and second.notify() when I want to to run but IllegalMonitorStateException... so if you know a tutorial or you can explain it me it'll be great!

Thanks!

[415 byte] By [sunnzneta] at [2007-10-1 23:33:02]
# 1

This is a bit hard to answer without a code example. Have you gone through the tutorial available on this topic?

http://java.sun.com/docs/books/tutorial/essential/threads/index.html

If you have already looked at these, post your sample code (inside code tags, please - use the code button above) so others can read it and run it.

timbella at 2007-7-15 15:21:48 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...