With the help of chiastic-security's comment, I wrote the code for you. As a beginner I would find it hard to understand otherwise.
// Method 1. Put the names into the array in the order they're entered, and then shuffle them afterwards.
String[] NamesArray = new String[10];
Scanner sc = new Scanner(System.in);
for (int i = 0; i < NamesArray.length; i++) {
System.out.print("Enter name No. " + (i + 1) + ": ");
String name = sc.next();
NamesArray[i] = name;
}
swapShuffle(NamesArray);
for (String name : NamesArray) {
System.out.println(name);
}
or alternatively,
// Method 2. Start by generating an array of integers from 0 to 9, and shuffle these integers; then use this array to determine where to place each name as it comes in.
Integer[] nameOrder = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
swapShuffle(nameOrder);
String[] NamesArray = new String[10];
Scanner sc = new Scanner(System.in);
for (int i = 0; i < NamesArray.length; i++) {
System.out.print("Enter name No. " + (i + 1) + ": ");
String name = sc.next();
NamesArray[nameOrder[i]] = name;
}
where both methods are using this static method for the shuffling:
public static void swapShuffle(Object[] objects) {
Random r = new Random();
for (int i = 0; i < objects.length; i++) {
int n = r.nextInt(objects.length);
Object o = objects[i];
objects[i] = objects[n];
objects[n] = o;
}
}