synchronized methods & blocks: Java locking mechanism; ensures that no other thread may access a synchronised method of the object; unsynchronised methods may still be accessed
notify(): notifies a particular thread waiting for access of a locked object as the locking thread unlocks it before exiting
notifyAll(): notifies all the threads waiting for access of a locked object as the locking thread unlocks it before exit
wait(): waits for access of a synchronised method of an object locked by another thread
synchronized method:
public synchronized int get(){
wait():
while (available == false){
try{
wait();
} catch (InterruptedException e){ }
}
notifyAll();: