如何创建记录 2 个不同团队之间的赢/输的方法?这是团队对象和构造函数。
public class NFLTeam4
{ private int win;
private int loss;
private String team;
public NFLTeam4(String teamName)
{ win = 0;
loss = 0;
team = teamName;
}
public NFLTeam4(int w, int l)
{ win = w;
loss = l;
}
}
这是我尝试创造一种赢得比赛的方法。
public class NFLGameDay4{
public static void main(String[] args){
NFLTeam4 falcons = new NFLTeam4("Falcons");
NFLTeam4 chiefs = new NFLTeam4("Chiefs");
NFLTeam4 jets = new NFLTeam4("Jets");
}
public NFLTeam4 winAGame(NFLTeam4 b)
{ int win = 1;
int loss = 0;
return new NFLTeam4(win, loss);
}