Hello , i know that notify() is responsible to wake up on of the threads waiting to access object and notifyAll() responsible to wake up all threads waiting to access same object but what it is the other different between these two methods ?? and which is better ?? Thanks a lot
posted 15 years ago
One of the advantages with notifyAll is that you can wake up all the threads without discrimination. With notify , you make wake up the thread that is not waiting on the same lock. So notifyall is better if there are multiple locks out there.