I am getting this error when running this code
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;
}
Can i get an explanation of whats wrong ?