Keep getting error class, interface, or enum expected
Posted
by
user1746605
on Stack Overflow
See other posts from Stack Overflow
or by user1746605
Published on 2012-10-15T09:25:48Z
Indexed on
2012/10/15
9:37 UTC
Read the original article
Hit count: 172
I can't see the problem with this short class. I get 8 class, interface, or enum expected errors. Thanks
public class BankAccount {
public BankAccount {
private double balance = 0;
}
public BankAccount(double balanceIn) {
private double balance = balanceIn;
}
public double checkBalance {
return balance;
}
public void deposit(double amount) {
if(amount > 0) balance += amount;
}
public void withdraw(double amount) {
if(amount <= balance) balance -= amount;
}
}
© Stack Overflow or respective owner