我被困在下面的代码中,尤其是下面的部分
public String getBalanceForCid(double balance){
double b = 0;
if (cid = custid)
b = balance;
else
b;
return
b;
}
请以正确的方式指导我。
package practices;
public class Bank {
public Bank(){
cid = 0;
cname = "";
actno = 0;
balance = 0;
}
public Bank(int custid, String custname, int custno, double custbal){
cid = custid;
cname = custname;
actno = custno;
balance = custbal;
}
public void setCustid(int custid){
cid = custid;
}
public void setCustname(String custname){
cname = custname;
}
public void setCustno(int custno){
actno = custno;
}
public void setCustbal(double custbal){
balance = custbal;
}
public int getCustoid(){
return cid;
}
public String getCustname(){
return cname;
}
public int getCustno(){
return actno;
}
public double getCustbal(){
return balance;
}
public String getBalanceForCid(double balance){
double b = 0;
if (cid = custid)
b = balance;
else
b;
return
b;
}
private int cid;
private String cname;
private int actno;
private double balance;
}
以上是我的挑战(我在这里再次输入此消息,因为我从SOF收到消息以添加更多详细信息
答案 0 :(得分:0)
让我们关注getBalanceForCid(...)方法:
您应该阅读有关if/else
条件
您应该阅读手册中有关类型/从方法返回数据类型以及一般有关方法的内容。然后是类中的访问者和变异者。