I cannot understand why we need to synchronized the wait() method. I can get java.lang.IllegalMonitorStateException after I removed this synchronized block.
http://www.linuxtopia.org/online_books/programming_books/thinking_in_java/TIJ315_021.htm
I cannot understand why we need to synchronized the wait() method. I can get
Share
Actually, the problem is:
wait()has to be in synchronized block. We can refer to: Why must wait() always be in synchronized block, answered by AnthonyM