Variable array names...i think
I have a list of arrays which need filling and i have created a for lop that will run the necessary commands to fill the arrays...
how do i put an array name into the 'for' loop that will change each time...
ie.
for(int x = 0; x < 3; x++)
{
array ?x? [index] = tempVariable;
}
Message was edited by: Reashlin
reashlin
[496 byte] By [
reashlina] at [2007-11-26 18:05:40]

You don't.
An array's index can be variable, but a variable's name cannot. If you really need "named" arrays, put the arrays into a map.
Map<String, int[]> arrayMap = new HashMap<String, int[]>();
int[] array1 = new int[10];
arrayMap.put("array1", array1);
array1[0] = 123;
http://java.sun.com/docs/books/tutorial/collections/
Or, if accessing the array by an index is enough, then just use an array of arrays.
int [][] arrays = new int[5][10];
array[0][0] = 1;
... etc. ..
> i had heard of multi dimensional arrays before
>but could not work out how to do them.
There you go
http://www.google.co.in/search?hl=en&client=firefox-a&rls=org.mozilla:en-US:official&hs=1ox&sa=X&oi=spell&resnum=0&ct=result&cd=1&q=java+multidimensional+arrays&spell=1