我的代码收到 stackOverflowError ,这意味着我的递归出现了问题。基本上我处于无限循环中,无法弄清楚如何消除此错误。
public ArrayList<ArrayList<String>> getLines(int firstLine, int
lastLine) {
for(int i=firstLine; i<=lastLine; i++) {
players.get(i).getAttributes();
}
return getLines(firstLine, lastLine);
}
我试图让我的代码返回一个数组数组。或者更简单地说是我所有玩家数组的数组
最佳答案
我相信您希望在进行递归调用时增加firstLine,并在firstLine == lastLine
时打破循环
关于java - 递归无限循环使我的代码被破坏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58280451/