I'm writing a code that is supposed to filter a thread of integers so that repeated values are removed
public class AboveBeyondPossible { public static void main(String[] args) { int N = Integer.parseInt(args[0]); int compare = Integer.parseInt(args[1]); N = StdIn.readInt(); while (!StdIn.isEmpty()) { N = StdIn.readInt(); if (N != compare) { System.out.print(" " + N); compare = N; } } System.out.println(N); } }
Error: Java.lang.ArrayIndexOutOfBoundsException:0