1 | Suppose that several threads are updating a bank balance (i.e., several threads can access one instance of class Account below). Then a thread that finds insufficient funds to debit an account can wait until another thread adds to the account: |
2 | public class Account |
3 |
{ int bankBalance; ...
|