简体   繁体   English

未定义Double类型的deposit(double)方法

[英]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.

相关问题 Car Anylogic 类型未定义方法 getDistanceByRoute(double, double, double, double) - The method getDistanceByRoute(double, double, double, double) is undefined for the type Car Anylogic 方法 areEqualByThreeDecimalPlace(double, double) 对于 DecimalComparator 类型未定义 - The method areEqualByThreeDecimalPlace(double, double) is undefined for the type DecimalComparator 未为类型Loan?定义方法Loan(double,int,double)。 - The method Loan(double, int, double) is undefined for the type Loan? 对于类型为new ActionListener(){}的方法xy(double,…)未定义 - The method xy(double, …) is undefined for the type new ActionListener(){} 如何解决 main 类型中的方法 add(double, double, int, double) 不适用于参数 (double, double, double, double) - how to solve The method add(double, double, int, double) in the type main is not applicable for the arguments (double, double, double, double) 未为类型Math定义IEEEremainder(double,double) - IEEEremainder(double, double) is undefined for the type Math “方法Double(String)未定义”(如何转换为Double?) - “The method Double(String) is undefined” (How to cast to Double?) 错误:&lt; 运算符未定义参数类型 Double[], double - error: the < operator is undefined for the arguments type(s) Double[], double 对于参数类型double,Point2D.Double,运算符*未定义 - The operator * is undefined for the argument type(s) double, Point2D.Double Method(double, double) 不适用于参数 (double[], double[]) - Method(double, double) is not applicable for the arguments (double[], double[])
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM