在以下情况下尝试此 *** 作:
if (change.wasUpdated()) { String inj = (data.get(change.getFrom()).injured.getValue())?"injuried":"no longer injuried"; System.out.println(data.get(change.getFrom()).lastName.getValue() + ", " + data.get(change.getFrom()).firstName.getValue() + " " + "changed his status to " + inj); System.out.println(); }
请注意 ,仅当播放器受伤时才会显示输出,否则将为空白:
选定的行:Gareth Bale(受伤)
选定的行:Gareth Bale
替换为:
选择的行:Gareth Bale true
选定的行:Gareth Bale错误
您还必须在播放器类中更改此功能:
public String toString() { return firstName.get() + " " + lastName.get() + (injured.get()?" true":" false");}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)