Register now or log in to join your professional community.
int[3][4] matrix = new int[3][4];
fillMatrix(matrix);
for(int i =0; i < matrix.length; ++i) {
for(int j =0; j < matrix[i].length; ++j) {
// access matrix[i][j] and do something
}
}
Your example is not clear. However, nested for-loops are what is used for multidimensional arrays, which are called matrices once they're above1 dimension.