previous | start | next

withdraw Method to Avoid Deadlock

public synchronized void withdraw(double amount)
   throws InterruptedException
{
   while (balance < amount)
      wait();
}


previous | start | next