I have tried everything and nothing seems to work.
I keep getting confusing errors every time.
Can I please have some help?! I don't see what's wrong.
Error:
NullPointerException(java:28)
//I also had errors on lines 27-29.
Thank you!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 == "") break;
String s2 = s.toString();
int x = Integer.parseInt(s2);
mainlist.add(x);
if (x % 2 == 0)
listwo.add(x);
if (x % 3 == 0)
listhree.add(x);
else
listonone.add(0, x);
}
}
public static void printList(List<Integer> list) {
//write your code here
}
}