Looks like this is what you want

    int columns = 2;
    int rows = 2;

    String[][] newArray = new String[columns][rows];
    newArray[0][0] = "France";
    newArray[0][1] = "Blue";

    newArray[1][0] = "Ireland";
    newArray[1][1] = "Green";

    for(int i = 0; i < rows; i++){
        for(int j = 0; j < columns; j++){
            System.out.println(newArray[i][j]);
        }
    }

Here I'll explain the code:

This declares the size of your new 2D array. In Java (and most programming languages), your first value starts at 0, so the size of this array is actually 2 rows by 2 columns

    int columns = 2;
    int rows = 2;

Here you are using the type String[][] to create a new 2D array with the size defined by [rows][columns].

    String[][] newArray = new String[columns][rows];

You assign the values by its placement within the array.

    newArray[0][0] = "France";
    newArray[0][1] = "Blue";

    newArray[1][0] = "Ireland";
    newArray[1][1] = "Green";

Looping through i would loop through the rows, and looping through j would loop through the columns. This code loops through all rows and columns and prints out the values in each index.

    for(int i = 0; i < rows; i++){
        for(int j = 0; j < columns; j++){
            System.out.println(newArray[i][j]);
        }
    }

Alternatively, assignment can be a one-liner:

    String[][] newArray = {{"France", "Blue"}, {"Ireland", "Green"}};

But I don't like this way, as when you start dealing with larger sets of data (like 10,000+ points of data with many columns), hardcoding it in like this can be rough.

Answer from theGreenCabbage on Stack Overflow
๐ŸŒ
Grails
grails.asia โ€บ two-dimensional-string-array-in-java
Two Dimensional String Array in Java - Grails Cookbook
June 29, 2017 - Both have the same effect of declaring two dimensional String Array. ... We can create an instance with the size of the array. We can use the new operator to create an instance and specify the size of each dimension. For example, here is how we declare an eight by eight String Array:
๐ŸŒ
Blogger
javarevisited.blogspot.com โ€บ 2016 โ€บ 02 โ€บ 6-example-to-declare-two-dimensional-array-in-java.html
6 ways to declare and initialize a two-dimensional (2D) String and Integer Array in Java - Example Tutorial
June 28, 2025 - This is the key to writing an algorithm ... etc. Now, that you know what is a 2D or two-dimensional array in Java, let's see a couple of examples of how to create and initialize a 2D array. I have chosen both int and String arrays as they are the most common type of array you ...
๐ŸŒ
Java67
java67.com โ€บ 2014 โ€บ 10 โ€บ how-to-create-and-initialize-two-dimensional-array-java-example.html
How to declare and Initialize two dimensional Array in Java with Example | Java67
You can access elements of a two-dimensional array either by using both indexes or just one index. For example salutation[0][1] represents a Single String in Java, while salutation[0] represents a one-dimensional array ( a single row in the ...
๐ŸŒ
Bestprog
bestprog.net โ€บ en โ€บ 2019 โ€บ 02 โ€บ 10 โ€บ arrays-of-strings-in-java-one-dimensional-and-two-dimensional-arrays-of-strings-initialization-of-arrays-of-strings-examples-of-tasks-solving
Java. Arrays of strings. One-dimensional and two-dimensional arrays of strings. Initialization of arrays of strings. Examples of tasks solving | BestProg
February 10, 2019 - The one-dimensional array of strings is of type String[]. The two-dimensional array of strings is of type String[][]. The general form of the declaration and the memory allocation for a one-dimensional array of strings is as follows ... String โ€“ a built-in Java class that implements a string of characters.
๐ŸŒ
Learn Java
javatutoring.com โ€บ java-two-dimensional-array
Two Dimensional Array In Java โ€“ JavaTutoring
May 26, 2026 - To print the elements of two-dimensional string array for i=0 to i<3 for j=0 to j<2 prints the string element which is at the index str[i][j]. 2) Here i indicates row number and j indicates column number ...
๐ŸŒ
Blogger
javarevisited.blogspot.com โ€บ 2016 โ€บ 02 โ€บ 6-example-to-declare-two-dimensional-array-in-java.html
Javarevisited: 6 ways to declare and initialize a two-dimensional (2D) String and Integer Array in Java - Example Tutorial
This is the key to writing an algorithm involving multi-dimensional arrays like looping through a 2D array, searching elements, etc. Now, that you know what is a 2D or two-dimensional array in Java, let's see a couple of examples of how to create and initialize a 2D array. I have chosen both int and String arrays as they are the most common type of array you will find while coding.
๐ŸŒ
Programiz
programiz.com โ€บ java-programming โ€บ multidimensional-array
Java Multidimensional Array (2d and 3d Array)
... class MultidimensionalArray { public static void main(String[] args) { // create a 2d array int[][] a = { {1, 2, 3}, {4, 5, 6, 9}, {7}, }; // calculate the length of each row System.out.println("Length of row 1: " + a[0].length); System.out.println("Length of row 2: " + a[1].length); ...
Find elsewhere
๐ŸŒ
Runestone Academy
runestone.academy โ€บ ns โ€บ books โ€บ published โ€บ csjava โ€บ Unit9-2DArray โ€บ a2dSummary.html
9.3. 2D Arrays Summary โ€” CS Java
In this case you donโ€™t need to specify the size of the array, it will be determined from the number of values that you specify. Example: String[][] seatingInfo = { {"Jamal", "Maria"}, {"Jake", "Suzy"}, {"Emma", "Luke"}}; This will create a 2d array with 3 rows and 2 columns.
๐ŸŒ
Tinyappco
tutorials.tinyappco.com โ€บ Java โ€บ TwoDimensionalArrays
Two Dimensional Arrays | Java | Andrew's Tutorials
String[] andrewsInfo = staffMembers[2]; //{"Andrew", "TAS033", "CO4025"} String andrewsOffice = andrewsInfo[1]; //TAS033 ยท As we can iterate through one dimensional array using a loop, we can iterate through a two dimensional array using a loop inside another loop. Using the above example, we could print out all the information from every entry in both arrays as follows using a foreach loop as follows ยท
๐ŸŒ
Stack Overflow
stackoverflow.com โ€บ questions โ€บ 58053930 โ€บ input-string-into-two-dimensional-array-in-java
Input string into two dimensional array in java - Stack Overflow
added a guard if the scanner is empty, then eject; this is probably something you won't need to keep but I added it so my example works ... public static void main(String[] args) { Scanner scanner = new Scanner("3 B B S S B F B B F 3"); int charactersPerLine = scanner.nextInt(); String[][] dice = new String[5][charactersPerLine]; for (int i = 0; i < 5; i++) { for (int j = 0; j < charactersPerLine; j++) { if (!scanner.hasNext()) { break; } dice[i][j] = scanner.next(); } } System.out.println(Arrays.deepToString(dice)); }
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ java โ€บ arrays-deeptostring-in-java-with-example
Arrays.deepToString() in Java with Example - GeeksforGeeks
July 23, 2025 - If the array is null, the method returns the string "null". In this example, we will use the Arrays.deepToString() method to print a two-dimensional array, which will display the nested elements correctly.
๐ŸŒ
Stack Overflow
stackoverflow.com โ€บ questions โ€บ 55249905 โ€บ how-to-store-2-dimensional-string-array-java
How to store 2-dimensional String array (java) - Stack Overflow
March 20, 2019 - I'm trying to do a 2-dimensional String array method which takes 3 parameters (String array and two ints), the String array is already defined in the main method as (String [] stringArray = {"1", "2" , "3", "4", "5"};) and the two integers are ...
๐ŸŒ
freeCodeCamp
freecodecamp.org โ€บ news โ€บ 2d-array-in-java-two-dimensional-and-nested-arrays
2D Array in Java โ€“ Two-Dimensional and Nested Arrays
August 10, 2022 - ... int[][] oddNumbers = { {1, 3, 5, 7}, {9, 11, 13, 15}, {17, 19, 21, 23} }; System.out.println(oddNumbers[2][2]); // 21 ยท You can loop through all the items in a two dimensional array by using a nested loop.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ java โ€บ multidimensional-arrays-in-java
Java Multi-Dimensional Arrays - GeeksforGeeks
... public class Geeks { public static void main(String[] args) { // Declaring a 2D array int[][] arr; // Initializing row and column sizes arr = new int[1][3]; // Assigning values arr[0][0] = 3; arr[0][1] = 5; arr[0][2] = 7; // Displaying values ...
Published ย  May 4, 2026
๐ŸŒ
W3Schools
w3schools.com โ€บ java โ€บ java_arrays_multi.asp
Java Multi-Dimensional Arrays
Java Examples Java Videos Java ... in a table with rows and columns. To create a two-dimensional array, write each row inside its own curly braces:...
๐ŸŒ
Dot Net Perls
dotnetperls.com โ€บ 2d-java
Java - 2D Array Examples - Dot Net Perls
October 1, 2024 - Here I develop a flattened 2D array, ... multiplied by the number of rows. Two indexes are combined into one. public class Program { public static void main(String[] args) { // Create 4 by 4 one-dimension array....
๐ŸŒ
Ruby-Doc.org
ruby-doc.org โ€บ home โ€บ two dimensional array in java โ€“ the ultimate guide with examples
Two Dimensional Array in Java - The Ultimate Guide with Examples - Ruby-Doc.org
April 10, 2026 - This article dives deep into the concept of a two dimensional array in Java, explaining what it is, how to declare and initialize it, and practical examples showcasing its use.