I need to make a program to compare if an element in an array has the same value, if there is an element in the array that are the same, it prints "Yes", otherwise "No".
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
public class DistinctNumbers {
public static void main(String[] args) throws FileNotFoundException {
Scanner scanner = new Scanner(new File("numbers.in"));
int sizeN = scanner.nextInt();
int[] arrayA = new int[sizeN];
for (int i = 0; i < arrayA.length; i++) {
for (int j = i + 1; j < arrayA.length; j++) {
arrayA[j] = scanner.nextInt();
if (arrayA[0] == arrayA[i++]) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
}
}