I have an array that looks like this
static String[][][] School= new String[1000][20][5];
Your array won't do what you expect it to do.
Think of the array like a 3D array, with each element a point. If you specify a single index, you're essentially telling the computer "OK, I want to assign "A1"
to this slice of the array (in your example, you're trying to do something akin to String[][] elementAtI = "A1";
). Now that doesn't make sense, does it?
To get to a single element in the array, you have to specify all three indices, much like how in 3D space you have to specify all three coordinates to locate a point:
School[3][4][5] = "A1";
What might be a better idea than a 3D array is objects. Packing everything into an array works, but that's not as readable as having a SchoolClass[]
, where each SchoolClass
has a name
and an array of Students
, and each Student
has an ID
, name
, etc.