[英]The method deposit(double) is undefined for the type Double
in class BankAccount: 在BankAccount类中:
public double deposit(double PlusAmount) {
balance += PlusAmount;
return balance;
in Main class 在主班
double PlusAmount = Double.parseDouble(dispFieldText);
double MinAmount = Double.parseDouble(dispFieldText2);
ba.balance.deposit(PlusAmount);
ba.balance.withdraw(MinAmount);
i've tried to change double -> Double but it did't help. 我试图改变双->双但没有帮助。 Please, help. 请帮忙。
The problem is that you're trying to call deposit
on ba.balance
which is of type Double
. 问题是您要在类型为Double
ba.balance
上调用deposit
。
Assuming ba
is of type BankAccount
, you should call the methods like this: 假设ba
的类型为BankAccount
,则应调用以下方法:
ba.deposit(PlusAmount);
ba.withdraw(MinAmount);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.