无法弄清楚如何编写我的方法,我尝试的任何操作都会给我编译错误。总之,我需要我的方法遍历我传递下来的布尔数组。了解False是否连续出现,或者True是否连续出现。在我提供的False数组中出现了更多的连续性,因此它应该将false返回给main。我现在完全失去了任何提示?Boolean在方法中返回True或False
public class booleanTF
{
public static void main(String [] args)
{
boolean[] guess = {false,true,false,false,false,true,true};
}
public static boolean longerTF(boolean[] guess)
{
int variable = 0;
for(int x = 0; x < guess.length; x++)
{
if(guess[x]
}
}
请参考[游览],学习http://stackoverflow.com/help/how-to-ask并制作[mcve]。 – Yunnosch
可能[复制](http://stackoverflow.com/questions/43509871/boolean-array-passed-to-method-to-return-true-or-false) –
所以你不会包括编译错误? – John3136