The code below works fine in eclipse (my java compiler) but for some reason when I type the code here in gives me the error NZEC, can someone explain to me why this is happening?
Code:
import java.util.*;
import java.lang.*;
class Main
{
public static void main (String[] args) throws java.lang.Exception
{
int cases;
int counter;
int[] listOne;
int[] listTwo;
String output;
Scanner sc = new Scanner(System.in);
cases = sc.nextInt();
listOne = new int[cases];
getList(cases, listOne);
cases = 0;
cases = sc.nextInt();
listTwo = new int[cases];
getList(cases, listTwo);
output = "";
for (int i = 0; i < listOne.length; i++) {
counter = 0;
for (int j = 0; j < listTwo.length; j++) {
if(listOne[i] != listTwo[j]) {
counter++;
if(counter == listTwo.length)
output += listOne[i] + " ";
}
}
}
System.out.println(output);
}
private static void getList(int cases, int[] a) {
Scanner sc = new Scanner(System.in);
for (int i = 0; i < cases; i++) {
a[i] = sc.nextInt();
}
}
}