Answers
- Two, one for each bank account object. Each lock protects a separate balance
field.
- When a thread calls deposit, it continues to own the lock, and any other thread
trying to deposit or withdraw money in the same bank account is blocked
forever.