Java Boolean有关withdrawpublic boolean withdraw(double amount)Withdraws the given amount from the account and returnstrue if the resulting balance is positive.Leaves the account balance unchanged and returns falseif the resulting balance would be n

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/01 11:12:54

Java Boolean有关withdrawpublic boolean withdraw(double amount)Withdraws the given amount from the account and returnstrue if the resulting balance is positive.Leaves the account balance unchanged and returns falseif the resulting balance would be n
Java Boolean有关
withdraw
public boolean withdraw(double amount)
Withdraws the given amount from the account and returns
true if the resulting balance is positive.
Leaves the account balance unchanged and returns false
if the resulting balance would be negative.
Parameters:
amount - Amount of the withdrawal
Returns:
True if successful,false if unsuccessful
public boolean withdraw(double amount,int times) {
return withdraw(amount*times);
}
return中用的 withdraw是什么

Java Boolean有关withdrawpublic boolean withdraw(double amount)Withdraws the given amount from the account and returnstrue if the resulting balance is positive.Leaves the account balance unchanged and returns falseif the resulting balance would be n

重载方法,你的这个类中有2个方法名相同的方法,分别是:

public boolean withdraw(double amount);//只有一个参数
public boolean withdraw(double amount, int times) {//2个参数
        return withdraw(amount*times);//这里调用一个参数的方法
    }