JAVA: storing input into array
Posted
by Jann
on Stack Overflow
See other posts from Stack Overflow
or by Jann
Published on 2010-06-14T04:39:48Z
Indexed on
2010/06/14
4:42 UTC
Read the original article
Hit count: 291
I need to write a program where the program would generate random letter and i would need to store this random character into 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 anything wrong with my code? because when i run this and printed the array i get boxes for all the values in the array and there are some letter that this line of code cannot print
System.out.print(arrayRandomLetter[randomNumLet] + " ");
Thanks
© Stack Overflow or respective owner