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

What will the output be?

class BankAccount {
    private double balance;

    public BankAccount(double initialBalance) {
        balance = initialBalance;
    }

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

    public void withdraw(double amount) {
        if (amount <= balance) {
            balance -= amount;
        }
    }

    public double getBalance() {
        return balance;
    }
}

public class Test {
    public static void main(String[] args) {
        BankAccount account = new BankAccount(200);
        account.deposit(150);
        account.withdraw(100);
        System.out.println(account.getBalance());
    }
}