One of my school works tells us to make an 2D array, and display what is in the array. I don't know why it is saying out of bounds, and am kind of stuck. What we where tasked to do is to make, 10 student IDs and 3 tests with scores for each of them, as shown below in the first row of the Array. The for loop part was designed to move on to the next column after x reaches 3 (when the final test score is displayed).
public class TwoDArray {
public static void main(String [] args) {
int [] [] musicScores = { {1001, 2002, 3003, 4004, 5005,6006,7007,8008,9009,1010,},{10,7,8,9,5,10,8,7,6,9},{9,8,10,9,9,10,9,9,7,9},{8,7,8,9,8,7,8,10,8,8}};
int y = 0;
for (int x = 0; x < 4; x++) {
System.out.print(musicScores[x][y] + "\t");
for (x = 3;y < 10; y++) {
x = 0;
System.out.println("");
}
}
}
}