<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">public class Sample11 {
    
    public static void main(String[] args) {
        Account11 acc = new Account11(1000);
        Client11 c1 = new Client11(acc);
        Client11 c2 = new Client11(acc);
        c1.start();
        c2.start();
    }
}

class Client11 extends Thread {
    private Account11 account;
    
    Client11(Account11 acc) {
        account = acc;
    }
    
    @Override
    public void run() {
        account.deposit(100);
    }
}

class Account11 {
    private int balance;
    
    Account11(int bal) {
        balance = bal;
    }
    
    synchronized void deposit(int money) {
        int bal = balance;
        bal = bal + money;
        
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) { }
        
        balance = bal;
        
        System.out.println("Current balance = " + balance);
    }
}
</pre></body></html>