Hi, I got correct results in console but received few erros during the compilation. Do you know why? : )
package pl.codegym.task.task07.task0713;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
/*
Granie w Javarellę
*/
public class Solution {
public static void main(String[] args) throws Exception {
ArrayList<Integer> list = new ArrayList<>();
ArrayList<Integer> list2Divisible = new ArrayList<>();
ArrayList<Integer> list3Divisible = new ArrayList<>();
ArrayList<Integer> remainNumbers = new ArrayList<>();
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
for (int i = 0; i < 20; i++) {
System.out.println("podaj liczbe");
list.add(Integer.parseInt(reader.readLine()));
}
for (int i = 0; i < list.size(); i++) {
if(list.get(i) % 3 == 0) {
list3Divisible.add(list.get(i));
}
}
for (int i = 0; i < list.size(); i++) {
if(list.get(i) % 2 == 0) {
list2Divisible.add(list.get(i));
}
}
for (int i = 0; i < list.size(); i++) {
if(list.get(i)%2 !=0 && list.get(i)%3 !=0) {
remainNumbers.add(list.get(i));
}
}
System.out.println("list which is divided by 3");
printLista(list3Divisible);
System.out.println("list which is divided by 2");
printLista(list2Divisible);
System.out.println("remain numbers");
printLista(remainNumbers);
}
public static void printLista(ArrayList<Integer> lista) {
for (Integer integer : lista) {
System.out.println(integer);
}
}
}