You have forgotten to give the variable a name? Both of these work.
String[][] array = {emptyArr, filledArr, moreFilledArr};
String[][] array = new String[][] {emptyArr, filledArr, moreFilledArr};
I recommend you to go through the basic Java syntax specification and tutorials. Start with The Java Tutorials by Oracle Corp, free of cost.
Answer from Nikolas on Stack OverflowGeeksforGeeks
geeksforgeeks.org โบ java โบ string-arrays-in-java
String Arrays in Java - GeeksforGeeks
October 2, 2025 - So generally we have three ways to iterate over a string array. The first method is to use a for-each loop. The second method is using a simple for loop. And the third method is to use a while loop.
DigitalOcean
digitalocean.com โบ community โบ tutorials โบ java-string-array
Java String Array: Declaration, Initialization & Examples | DigitalOcean
August 3, 2022 - Even java main method argument ... String array is basically an array of objects. There are two ways to declare string array - declaration without size and declare with size....
How to create and initialise in Java an array of String arrays in one line? - Stack Overflow
please do check these too Docs ... with java docs , I had to add this as a comment but I couldn't, I want to extend with more resources mentioned above , Thanks ... We can also achieve it by initialising and assigning to a single dimensional array of type Object. Something like below. String[] filledArr ... More on stackoverflow.com
Java - How do I make a String array with values? - Stack Overflow
I know how to make an empty array, but how do I make a String array with values from the start? More on stackoverflow.com
Java- Converting a string of numbers separated by spaces into an array?
You have the right idea. String.split() will return an array of strings. Then, if you want to treat any individual string in that array as an integer you can use Integer.parseInt() . If you want to create an array of integers, just make the array that way. More on reddit.com
In Java, how do static arrays of Strings work? Strings are arrays of characters, so when the array of Strings is initialized with a given size, how does Java know how much memory to allocate?
It's really just an array of references (this means 32 or 64 bit addresses depending on the platform), no memory is allocated for the string objects. More on reddit.com
Videos
07:40
String arrays in Java, how to declare and init in one line - YouTube
03:40
Making an Array Of Strings | Java For Beginners - YouTube
12:16
Java Tutorial - 14 - Arrays of Strings - YouTube
02:27
Java - Initialize String Arrays | Arrays in Java - YouTube
Java Programming Tutorial - 32 - Arrays in Methods
25:51
Array & String in java | DSA - YouTube
W3Schools
w3schools.com โบ java โบ java_arrays.asp
Java Arrays
Java Examples Java Videos Java ... declaring separate variables for each value. To declare an array, define the variable type with square brackets [ ] : ... We have now declared a variable that holds an array of ...
Naukri
naukri.com โบ code360 โบ library โบ how-to-declare-string-array-in-java
How to Declare String Array in Java
July 23, 2025 - Almost there... just a few more seconds ยท <img src="https://www.naukri.com/akam/13/pixel_588cd50e?a=dD0xNGMwN2NhZDZkMDg5NTk0OGVkOTRhNWU2YTU1YTg3OWI3N2FiZmUwJmpzPW9mZg==" style="visibility: hidden; position: absolute; left: -999px; top: -999px;" />
Top answer 1 of 3
2
You have forgotten to give the variable a name? Both of these work.
String[][] array = {emptyArr, filledArr, moreFilledArr};
String[][] array = new String[][] {emptyArr, filledArr, moreFilledArr};
I recommend you to go through the basic Java syntax specification and tutorials. Start with The Java Tutorials by Oracle Corp, free of cost.
2 of 3
0
these two are right too String[][] array = {emptyArr, filledArr, moreFilledArr};
String[][] array = new String[][] {emptyArr, filledArr, moreFilledArr};
please do check these too
Docs for Array in Java Have a Look for more clarification
tutorial of array with java docs
,
I had to add this as a comment but I couldn't, I want to extend with more resources mentioned above , Thanks
Whitman College
whitman.edu โบ mathematics โบ java_tutorial โบ java โบ nutsandbolts โบ arraysAndStrings.html
Arrays and Strings
Notice the use of arrayOfInts.length to retrieve the current length of the array. length is a property provided for all Java arrays. Arrays can contain any legal Java data type including reference types such as objects or other arrays. For example, the following declares an array that can contain ten String objects.
Java2Blog
java2blog.com โบ home โบ core java โบ string โบ how to declare a string array in java
How to declare a String array in java - Java2Blog
April 15, 2021 - We can also declare a String array and can initialize it later. ... We can also use Java 8โs setAll() method and pass a generator to initialize String array in java.
Python Examples
pythonexamples.org โบ java โบ how-to-declare-a-string-array
How to Declare a String Array in Java
We declare a string array named stringArray using array literal syntax with predefined string values. We print the array elements to the console to demonstrate the initialization. import java.util.Arrays; // Declare and Initialize a String Array public class Main { public static void main(String[] ...
Alvin Alexander
alvinalexander.com โบ java โบ java-string-array-reference-java-5-for-loop-syntax
Java String array examples (with Java 5 for loop syntax) | alvinalexander.com
As this example shows, Java arrays begins with an element numbered zero; they are zero-based, just like the C programming language. If you need a String array but donโt initially know how large the array needs to be, you can declare an array variable without giving it an initial size, like this:
Top answer 1 of 5
170
You could do something like this
String[] myStrings = { "One", "Two", "Three" };
or in expression
functionCall(new String[] { "One", "Two", "Three" });
or
String myStrings[];
myStrings = new String[] { "One", "Two", "Three" };
2 of 5
7
By using the array initializer list syntax, ie:
String myArray[] = { "one", "two", "three" };
Board Infinity
boardinfinity.com โบ blog โบ string-array-in-java
String Array in Java | Board Infinity
August 20, 2025 - The string is only an object that represents a list of char values. In Java, strings are immutable. In Java, immutable refers to strings that cannot be changed. It is known as a String Array in Java when a String array is created. A String array must first be declared and initialized before it can be used.
Edureka
edureka.co โบ blog โบ string-array-in-java
Java String Array | String Array in Java with Examples | Edureka
July 5, 2024 - Since there are only 3 elements in stringArray3, and the index starts from 0, the last index is 3. We could also use the formula (array length โ 1) to ascertain the value of the index. On accessing an index greater than 2, an exception will be raised. ... This will throw a java.lang.ArrayIndexOutOfBoundsException. Initialization of a string array can be done along with the declaration by using the new operator in the syntax:
Scaler
scaler.com โบ home โบ topics โบ string array in java
String Array in Java - Scaler Topics
April 28, 2024 - The above statement declares a string array of size five where arr is the name of the array and String is the data type for the array. However, you can also write the above declaration as - Both of the above declarations can be used. However, out of the three declarations, the first one is more efficient and is suggested for use. Initialization means to put a value into the variable. However, the data types in Java are, by default, initialized by their default values as soon as they are declared.
Upgrad
upgrad.com โบ home โบ tutorials โบ software & tech โบ string arrays in java
String Array in Java โ How to Declare, Initialize, Iterate, and Use
May 14, 2025 - Explanation: Here, you're declaring an array named colors that will store string values. At this stage, no memory is allocated, and no values are assigned โ that comes later. This step is important because Java is a statically-typed language, so you must define the type and structure of your variables beforehand.