I have two things wrong and I cannot figure this out. I have been here for ages trying to work it out, but in vain.
Can you please help?! I have two parts wrong!
Thank you for your help!
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> mainlist = new ArrayList<Integer>();
ArrayList<Integer> listhree = new ArrayList<Integer>();
ArrayList<Integer> listwo = new ArrayList<Integer>();
ArrayList<Integer> listonone= new ArrayList<Integer>();
while (true)
{
String s = reader.readLine();
if (s==null || s.equals("")) break;
//String s2 = s.toString();
int x = Integer.parseInt(s);
mainlist.add(x);
if (x % 2 == 0)
listwo.add(x);
if (x % 3 == 0)
listhree.add(x);
if (x % 2 != 0 && x % 3 != 0)
listonone.add(0, x);
// if blahblahblah.
// listhree.add(x);
// listwo.add(x);
// mainlist.add(x);
}
//printList(mainlist);
printList(listhree);
printList(listwo);
printList(listonone);
}
public static void printList(List<Integer> list) {
//write your code here
System.out.println(list);
}
}