having a small problem.
I’m trying to create a loop that will create an amount of strings equal to an user-input int value, I’ve been scratching my head for about half an hour but can’t really work out how I’d do this.
int x =Integer.parseInt(JOptionPane.showInputDialog("How many String do you want to add to the Queues?"));
for (int i=0; i<x; i++)
{
String string(i) = (char)(i+65);
}
I know the inner part of the loop is incorrect, but I wrote it to express what I’m trying to achieve, how do I get the code to recognize, “String” as part of the name string, but i as a char to be added to that namestring for that variable?
The hope is to allow someone to enter 5 for example and then have it create
string0 = a, string1 = b, string2 = c etc.
Can anyone help me with this?
This creates an array of strings, each string having a character. First string is “a”, next “b” etc. Depending on how many string you are making, you might get non displayable ASCII chars in the string.