Multi-Dimensional Arrays in Java


Multi-dimensional arrays are arrays of arrays, often used to create matrices or tables.

Source Code

int[][] matrix = {
    {1, 2, 3},
    {4, 5, 6},
    {7, 8, 9}
};
System.out.println(matrix[1][1]); // Outputs 5

Use multi-dimensional arrays to store complex data structures like matrices.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments