Declaring
Let's declare a 2D array with 3 rows and 5 columns
int[][] exampleArr;
This 2D array is only declared, and doesn't have any data. Let's put some in it!
Initializing
// Use this type of initialization when yo plan on filling it later procedually (like in a loop)
int[][] exampleArr = new int[5][3]; //Sets all data to an int of zero
// Use this if you want data to give to your program that you don't need to calculate
int[][] exampleArr =
{
{1,2,3},
{3,6,9},
{9,18,27}
};
In Java, there are two ways to create arrays.
Just note that it usually is easier to use the first way for objects you created.
Now let's acutally use these arrays!