Cab someone help me explain why this is not working at all?
package com.codegym.task.task07.task0713;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
/*
Playing Javarella
*/
public class Solution {
public static void main(String[] args) throws Exception {
//write your code here
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
ArrayList<Integer> originalList = new ArrayList<Integer>();
ArrayList<Integer> numDiv3 = new ArrayList<Integer>();
ArrayList<Integer> numDiv2 = new ArrayList<Integer>();
ArrayList<Integer> numRest = new ArrayList<Integer>();
for(int i = 0; i < 20; i++){// enter 20 number from keyboard and aad them to the originalList
int c = Integer.parseInt(reader.readLine());
originalList.add(c);
}
for (Integer c : originalList){//loops over the originalList
if(c %3 == 0) // if the number is divisible by 3
{
numDiv3.add(c);// it will be added to the numDiv3 list
}
if(c %2 == 0) // if the number is divisble by 2
{
numDiv2.add(c); // it will be added to the numDiv2 list
}
if((c %3 == 0) && (c % 2 == 0)) // if the number is divived by 3 and 2 such as 6
{
numDiv3.add(c); //the number will be added to numDiv3
numDiv2.add(c);// and the number will be added to numDiv2
}
else
{
numRest.add(c);// all the remaining number will be added to the numrest list
}
}
printList(numDiv3);
printList(numDiv2);
printList(numRest);
}
public static void printList(List<Integer> list) {
//write your code here
for (Integer c : list) {//loops over de original list
System.out.println(c);
}
}
}