for (int j = 1; j <= elementsA; j++) {
System.out.print("Enter a number 1-10: ");
A.add(j);
}
There's nothing in this loop that inputs a number from the user. Instead, you're adding the loop index to the set, which means you're calling A.add(1)
, A.add(2)
, ...