Originally posted by Paul Sun:
When I use wait(), I get the following exception
java.lang.IllegalMonitorStateException: current thread not owner
Could someone tell me the reason?
You are going to have to put it in a synchronized block or method depending on what you are waiting on... of you are just calling wait() you are really doing this.wait() and that line needs to be in a synchronized method like I said above or in a block like this...
and it will probably need to be in a try-catch to catch InteruptedExceptions.