JAVA: storing input into array -
I have to write a program where the program will create random characters and I will need to store this random character in the array
four [] arrayRandom = new character [10]; {RandomNumLet = (generator.extant (20) + 1) for (int i = 0; i & lt; 8; i ++); System.out.print (array emimilarator [random name] + ""); ArrayRampatty Letter [Random Mile] = ArrayRemand [i]; }
Is there anything wrong with my code? Because when I run it and print the array, then I get the boxes for all the values in the array and there are some letters that can not print this line of code
System.out. Print (arrayRandomLetter [randomNumLet] + ""); Thanks
You are specifying an element of ArrayRandomLetter
from a value arrayRandom
. As you never start arrayRandom
, its values are all 0. 0 is not a printable character value, so boxes are
An easy way to choose a random character is:
string characters = "ABCDEFGHJJLMNOPQRTUVX"; Four random squares = cheers. Chart (random.number (chars.length ());
Comments
Post a Comment