我正在尝试将用户输入作为字符串读取。将其解析为一个 int,然后是用户输入的任何数字 (0-3),我想用卡片替换数组的索引。这是代码
public void discard(String text) {
int i = Integer.parseInt(text);
for(int p = 0; p < 4; p++){
if(i == p){
hand[p].getCard() = card; // This is where I recieve the Error.
}
}
}
任何能帮助我纠正和理解我的错误的东西都会有所帮助,谢谢!