问题是关于我的 if 语句。我正在比较三个相同类型的值,但我得到一个错误,例如“参数类型 == 未定义布尔、int 类型”问题是,如果我更改代码以使用 && 分别比较值.. 所以 value == value1 && value = value2,我没有收到错误。有什么不同?
Card[] cardsIn = cards;
boolean threeOfAKindEval = false;
//the for loops runs through every possible combination of the 5 card array. It starts at
//0,0,0 and ends at 5,5,5/ Inside the last for loop, I check for a three of a kind
//My if statement also checks to make sure I am not comparing the same card with
//itself three times
for(int index = 0; index < cards.length; index++){
for(int indexCheck = 0; indexCheck < cards.length;indexCheck++){
for(int indexCheckThree = 0; indexCheckThree < cards.length;
indexCheckThree++){
if(cardsIn[index].getValue() == cardsIn[indexCheck].getValue() == cardsIn[indexCheckThree].getValue())
threeOfAKindEval = true;
}
}
}