运行此代码时出现此错误
private static List<Integer> array(int num) {
List<Integer> value = new ArrayList<>();
while (num != 1) {
if(num % 2 == 0) {
value.add(num + 2);
}else {
value.add(num * 3 + 1);
}
}
System.out.println(value);
return value;
}
Run Code Online (Sandbox Code Playgroud)
我能得到什么错的解释吗?