Please could anyone help trying to figure it out? Want to instance different objects
Hi all,
I'm getting troubles on trying to instance a class into a for doing this:
for (int n = 0; n < PilaAuxiliar.Longitud(); n++){
String MyStackName = "p" + n; // This is to define the stack's name as P1...n
ClasePila MyStackName = new ClasePila(int_elementos_temp);
}
As you can see I want to instance as many stacks as n values I have, but when I tryo to compile it java says me that I'm trying to MyStackName repeated to the String name and the object name...:O
How can I iterate and assign the name to the object as an incremental number.
In my programm people will introduce how many stacks the are gonna use and then I have to create this quantity of stacks to be manipulated.
Thanks !
Grey