I want to put together a simple program that can take x amount of inputs, put them in an array, do the same thing again in a different array, and then check to see which inputs occur in both lists.
For obtaining the inputs, I can't think of a way for it to continue accepting any number of inputs and only stopping when the input says "stop" or "end" or something similar.
I'm a self-taught beginner, so pardon my ignorance when it comes to this stuff.
I haven't made the setup for the second array, but know how to do so (I'm fairly sure). I'm just stuck on the input issue and how to compare the inputs
//input of codes
System.out.println("How many codes do you wanna put in?");
x = input.nextInt();
int[] binList = new int[x];
System.out.println("Okay. Enter your codes:");
for (int n = 0; n < x; n++) {
binList[n] = input.nextInt();
}
//sort codes
Arrays.sort(binList);
//display codes
System.out.println("Here are your codes:");
for (int n = 0; n < x; n++) {
System.out.println(binList[n]);