I need to write a program in which the program will generate a random letter, and I will need to store this random character in an array
char[] arrayRandom = new char[10];
for (int i = 0; i < 8; i++) {
randomNumLet = (generator.nextInt(20) + 1);
System.out.print(arrayRandomLetter[randomNumLet] + " ");
arrayRandomLetter[randomNumLet] = arrayRandom[i];
}
Is there something wrong with my code? because when I run this and print the array, I get the fields for all the values in the array, and there is a letter that this line of code cannot print
System.out.print(arrayRandomLetter[randomNumLet] + " ");
thank
source
share