cannot make a static reference to the non-static field


e lines

account.withdraw(balance, 2500);
account.deposit(balance, 3000);

you might want to make withdraw and deposit non-static and let it modify the balance

public void withdraw(double withdrawAmount) {
    balance = balance - withdrawAmount;

public void deposit(double depositAmount) {
    balance = balance + depositAmount;

and remove the balance parameter from the call

Leave a Comment