The int should autobox but I do not know why it is not. When i try to compile, it gives me an incompatible types error. Is there something wrong with my code?
Scanner console = new Scanner(System.in);
ArrayList<Integer> list = new ArrayList<>();
int first = console.nextInt();
while (first!=0) {
first=console.nextInt();
list.add(first);
}
System.out.println("Your first list: " + list);
}