Why is this wrong?
package com.codegym.task.task07.task0713;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
/*
Playing Javarella
*/
public class Solution {
public static void main(String[] args) throws Exception {
ArrayList<Integer> inputList = new ArrayList<>();
ArrayList<Integer> mod3 = new ArrayList<>();
ArrayList<Integer> mod2 = new ArrayList<>();
ArrayList<Integer> otherNumbers = new ArrayList<>();
Scanner sc = new Scanner(System.in);
for (int i = 0; i < 20; i++) {
int input = sc.nextInt();
inputList.add(input);
}
for (int i = 0; i < inputList.size(); i++) {
if (inputList.get(i) % 3 == 0) {
mod3.add(inputList.get(i));
}
if (inputList.get(i) % 2 == 0) {
mod2.add(inputList.get(i));
}
else {
otherNumbers.add(inputList.get(i));
}
}
printList(mod3);
printList(mod2);
printList(otherNumbers);
}
public static void printList(List<Integer> list) {
for (Integer i : list) {
System.out.println(i);
}
}
}