gpt4 book ai didi

java - 尝试返回 2 个 boolean 值 Java

转载 作者:行者123 更新时间:2023-12-01 23:05:48 25 4
gpt4 key购买 nike

基本上,我有两个 boolean 值,称为“更高和相同”,我希望它们都在我的 isNextCardHigher 方法中返回

class HigherSame{
boolean higher = false;
boolean same = false;
boolean[] HandS = {higher, same};
}


boolean isNextCardHigher(TCard lastCard, TCard nextCard, HigherSame highersame, boolean HandS[] ){

if (nextCard.rank == lastCard.rank){//Higher = game over
boolean same, higher;

if(nextCard.rank == lastCard.rank){
same = true;
}

if (nextCard.rank > lastCard.rank){
higher = true;
}
return HandS[];

最佳答案

您可以更改HigherSame类的对象的返回类型,这样您就可以拥有两个 boolean 值。

关于java - 尝试返回 2 个 boolean 值 Java,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22769724/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com