Ввожу для проверки числа от 1 до 10, во второй список не попадает 6, почему, что не так?
public class Solution {
public static void main(String[] args) throws Exception {
//напишите тут ваш код
ArrayList<Integer> nums = new ArrayList<>();
ArrayList<Integer> onThree = new ArrayList<>();
ArrayList<Integer> onTwo = new ArrayList<>();
ArrayList<Integer> other = new ArrayList<>();
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
for (int i = 0; i < 10; i++){
nums.add(Integer.parseInt(reader.readLine()));
}
for (int i = 0; i < nums.size(); i++){
if (nums.get(i) % 2 == 0 && nums.get(i) % 3 == 0 || nums.get(i) % 3 == 0) {
onThree.add(nums.get(i));
}
else
if ((nums.get(i) % 2 == 0 && nums.get(i) % 3 == 0) || nums.get(i) % 2 == 0){
onTwo.add(nums.get(i));
}
else other.add(nums.get(i));
}
printList(onThree);
printList(onTwo);
printList(other);
printList(nums);
}
public static void printList(List<Integer> list) {
//напишите тут ваш код
for (int k : list){
System.out.println(k);
}
System.out.println();
}
}