After creating a new array object, I want to load it with constant values. Being a COBOL programmer, I would make a sequential file with the values, and read them into the array. But I don't want to do this with JAVA. My program will eventually be an applet and won't be able to read in a sequential file (it's a DOS app now). The answer is putting all the data in a class, and setting up the array in there. Now, I'm stuck with writing 625 lines of code that looks like: MyArray[1][1] = 31; MyArray[1][2] = 26; . . . MyArray[24][24] = 21; There's got to be a more practical way of loading this array with constants other than this way or reading from external files. But what is it? Thanks. :roll:
I am not insane. The voices in my head told me so.
Dave Landers
Ranch Hand
Joined: Jul 24, 2002
Posts: 401
posted
0
int[][] foo = { { 1, 2, 3 }, { 4,5, 6} };
James Chegwidden
Author
Ranch Hand
Joined: Oct 06, 2002
Posts: 201
posted
0
Also, remember subscripts start at 0 so array[0][0] etc.
Mr. C<br /> <br />Author and Instructor<br />My book:<br /><a href="http://www.aw-bc.com/catalog/academic/product/0,1144,1576761614,00.html" target="_blank" rel="nofollow">http://www.aw-bc.com/catalog/academic/product/0,1144,1576761614,00.html</a>