I am making lots of variables but I want to do this through a while statement.
The problem is that I cannot figure out how to use a variable as part of a variable name so that the variable being created in the loop id not created multiple times (and hence causing an error).
I have a loop like this:
int index = 0
while (index < 10){
JLabel A1 = new JLabel("A" + [index]);
index++;
}
Obviously I do not want all my variables called A1 as this isn't legal syntax. How do I have it so that my variables will be A[index]?