Menu
Coddy logo textTech

Multi-Dimensional

Lesson 13 of 16 in Coddy's Strings and Arrays in Java course.

A multi-dimensional array is an array of arrays.
To create a two-dimensional array, add each array within its own set of curly braces:

int[][] myNumbers = {{1, 2, 3, 4}, {5, 6, 7}};

An example of element access:

System.out.println(myNumbers[1][2]); // Outputs 7

And modifying elements:

myNumbers[1][2] = 5;
System.out.println(myNumbers[1][2]); // Outputs 5
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

Try it yourself

This lesson doesn't include a code challenge.

All lessons in Strings and Arrays in Java