在我的二十一点中,我让玩家击打或站立,然后测试结束循环你有这个代码:
int runLoopCount1 = 0;
for (int i = 0; i < players.length; i++) {
if (players[i].wantSplit = false){
if(players[i].getStatus() == true){
runLoopCount1++;
}
}
else if (players[i].wantSplit = true){
if ((players[i].splits[0].busted == true||
players[i].splits[0].standed == true) &&
(players[i].splits[1].busted== true ||
players[i].splits[1].standed == true)){ // null pointer here
runLoopCount1++;
}
}
}
if(runLoopCount1 == players.length){
runLoop = false;
}
现在我得到一个NullPointerException
. 我不知道为什么?