Latest News

 










Account Example

Previous slide Next slide Back to first slide View graphic version


Account Example


 
My other sites

Latest News

 










Account Example

  • This is an example of synchronized methods :

    public class Account {

    private double balance;

    public Acount(double initialDeposit) {

    balance = initialDeposit;

    }

    public synchronized double getBalance() {

    return balance;

    }

    public synchronized void deposit(double amount) {

    balance += amount;

    }

    }

Previous slide Next slide Back to first slide View graphic version