int[][] list = new int[5][5];
This creates a 5x5 integer array, called list. However, this would limit us to only holding integer values. If you want an array that holds numbers and words, you would have to use a string array.
String[][] list = new String[5][2];
For this example, I made a two dimensional string array that has five rows, and two columns. We can now populate the array by specifying which row and column you wish to edit. Remember that the rows begin with row 0, not row 1. Same goes for columns.
public class twodimensions { { array[0][0] = "Michael"; array[1][0] = "Jyoti"; array[2][0] = "Mario"; array[3][0] = "Sakura"; array[4][0] = "Maribeth"; array[0][1] = "30"; array[1][1] = "24"; array[2][1] = "41"; array[3][1] = "17"; array[4][1] = "55"; } }</java This is a basic example of a program that uses two dimensional arrays to store names and ages. They are all displayed to the user at the very bottom. As an exercise, try adding functionality so that the user inputs the ages themselves. Hint: You don't need to set initial values for the array containers that are going to be given values by the user's input.