الرجوع
تسجيل الدخول

What is the output of the above code?

public class Account {
    private double balance = 0;

    public void deposit(double amount) {
        if (amount > 0) {
            balance += amount;
        }
    }

    public double getBalance() {
        return balance;
    }
}

public class Test {
    public static void main(String[] args) {
        Account myAccount = new Account();
        myAccount.deposit(500);
        System.out.println(myAccount.getBalance());
    }
}