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 Overflow
🌐
W3Schools
w3schools.com › java › java_arrays.asp
Java Arrays
Java Examples Java Videos Java Compiler Java Exercises Java Quiz Java Code Challenges Java Practice Problems Java Server Java Syllabus Java Study Plan Java Interview Q&A ... Arrays are used to store multiple values in a single variable, instead of 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 strings.
🌐
GeeksforGeeks
geeksforgeeks.org › java › string-arrays-in-java
String Arrays in Java - GeeksforGeeks
October 2, 2025 - ... // Java program to demonstrate various // methods to iterate over a string array public class GFG { public static void main(String[] args) { String[] arr = { "Apple", "Banana", "Orange" }; // First method for (String i : arr) { ...
Discussions

How do I determine whether an array contains a particular value in Java? - Stack Overflow
Here is a full example of it. import java.util.Arrays; import java.util.List; import java.util.function.Predicate; public class Test { public static final List VALUES = Arrays.asList("AA", "AB", "BC", "CD", "AE"); public static void main(String args[]) { Predicate containsLetterA ... More on stackoverflow.com
🌐 stackoverflow.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
🌐 r/learnprogramming
9
1
December 16, 2022
So why aren't strings considered arrays?
Strings are character arrays in most languages... More on reddit.com
🌐 r/learnprogramming
22
4
November 30, 2020
How do I initialize a Java String array when doing java interop
(into-array String ["one" "two"]) More on reddit.com
🌐 r/Clojure
3
5
January 28, 2022
🌐
CodeGym
codegym.cc › java blog › java arrays › string array in java
String Array in Java
May 11, 2023 - To search for a needed String in a String array in Java, you can use a loop for iterating through each array element and compare it to the String you're searching for. Here's an example program:
🌐
DigitalOcean
digitalocean.com › community › tutorials › java-string-array
Java String Array: Declaration, Initialization & Examples | DigitalOcean
August 3, 2022 - Master Java String arrays with declaration, initialization, and manipulation examples. Learn iteration, sorting, searching, and conversion techniques.
🌐
Centron
centron.de › home › tutorials › java string array - tutorial
Java String Array - Tutorial – centron
March 1, 2024 - String array is very common in simple Java programs, especially among beginners to Java and to test some specific scenarios. Even the Java main method argument is a string array - public static void main(String[] args). So today, we will look into different aspects of the Java string array with example programs.
Find elsewhere
🌐
Jyotiprakash's Blog
blog.jyotiprakash.org › jyotiprakash's blog › #java › arrays, strings, and stringbuilder in java
Arrays, Strings, and StringBuilder in Java
December 18, 2024 - In the above example, each iteration creates a new string object, which can be very slow and memory-intensive for large loops. To avoid the inefficiencies of immutable strings, Java provides StringBuilder for mutable string manipulation.
🌐
Oracle
docs.oracle.com › javase › 8 › docs › api › java › util › Arrays.html
Arrays (Java Platform SE 8 )
July 21, 2026 - ClassCastException - if the array contains elements that are not mutually comparable (for example, strings and integers).
🌐
Scribd
scribd.com › document › 684397626 › Array-String-and-Vector
Java Arrays and Strings Overview | PDF | String (Computer Science) | Integer (Computer Science)
This document discusses arrays in Java. It defines an array as a group of related data items with a common name. It covers one-dimensional arrays, declaring and initializing arrays, and accessing array elements using subscripts. It also discusses two-dimensional arrays, variable-size arrays, and some common String and StringBuffer methods in Java.Read more
🌐
Edureka
edureka.co › blog › string-array-in-java
Java String Array | String Array in Java with Examples | Edureka
July 5, 2024 - String Array is used to store a fixed number of Strings. This Java String Array tutorial will help you learn string arrays along with working examples.
🌐
Coderanch
coderanch.com › t › 406173 › java › determine-string-array-string
How can I determine if a string array contains a particular string? (Beginning Java forum at Coderanch)
February 15, 2007 - You can take an ArrayList for example: If you don't like generics in your compositions, you can omit the <String> in this case. Yours, Bu. ... In an unordered list (java.util.List, array), you will definitely have to check every element to ensure that the element you are looking for isn't the ...
Top answer
1 of 16
3431
Arrays.asList(yourArray).contains(yourValue)

Warning: this doesn't work for arrays of primitives (see the comments).


Since java-8 you can now use Streams.

String[] values = {"AB","BC","CD","AE"};
boolean contains = Arrays.stream(values).anyMatch("s"::equals);

To check whether an array of int, double or long contains a value use IntStream, DoubleStream or LongStream respectively.

Example

int[] a = {1,2,3,4};
boolean contains = IntStream.of(a).anyMatch(x -> x == 4);
2 of 16
465

Concise update for Java SE 9

Reference arrays are bad. For this case we are after a set. Since Java SE 9 we have Set.of.

private static final Set<String> VALUES = Set.of(
    "AB","BC","CD","AE"
);

"Given String s, is there a good way of testing whether VALUES contains s?"

VALUES.contains(s)

O(1).

The right type, immutable, O(1) and concise. Beautiful.*

Original answer details

Just to clear the code up to start with. We have (corrected):

public static final String[] VALUES = new String[] {"AB","BC","CD","AE"};

This is a mutable static which FindBugs will tell you is very naughty. Do not modify statics and do not allow other code to do so also. At an absolute minimum, the field should be private:

private static final String[] VALUES = new String[] {"AB","BC","CD","AE"};

(Note, you can actually drop the new String[]; bit.)

Reference arrays are still bad and we want a set:

private static final Set<String> VALUES = new HashSet<String>(Arrays.asList(
     new String[] {"AB","BC","CD","AE"}
));

(Paranoid people, such as myself, may feel more at ease if this was wrapped in Collections.unmodifiableSet - it could then even be made public.)

(*To be a little more on brand, the collections API is predictably still missing immutable collection types and the syntax is still far too verbose, for my tastes.)

🌐
W3Schools
w3schools.com › java › java_howto_string_to_array.asp
Java How To Convert a String to an Array
Java Examples Java Videos Java Compiler Java Exercises Java Quiz Java Code Challenges Java Practice Problems Java Server Java Syllabus Java Study Plan Java Interview Q&A ... There are many ways to convert a string to an array.
🌐
Software Testing Help
softwaretestinghelp.com › home › java › java string array- tutorial with code examples
Java String Array- Tutorial With Code Examples
April 1, 2025 - In this method, you create an array having a larger size. For Example, if you have to store 5 elements in the array, then you will create an array with size 10. This way you can easily add new elements at the end of the array.
🌐
TheServerSide
theserverside.com › blog › Coffee-Talk-Java-News-Stories-and-Opinions › Java-array-size-explained-by-example
Java array size, length and loop examples
The length property tells you the Java array size. It is not a method. To further confuse matters, the String class does have a length() method.
Published: July 4, 2026
🌐
Medium
medium.com › @mgm06bm › java-string-collections-list-vs-array-choosing-the-right-option-57e14bc00466
Java String Collections: List vs. Array —Understanding Their Differences | Mehmood | Medium
January 4, 2024 - import java.util.List; List<String> listOfString = new ArrayList<>(); listOfString.add("Java"); listOfString.add("List"); listOfString.remove(0); system.out.println(listOfString); //[List]
🌐
Oracle
docs.oracle.com › javase › tutorial › java › nutsandbolts › arrays.html
Arrays (The Java™ Tutorials > Learning the Java Language > Language Basics)
You can also declare an array of arrays (also known as a multidimensional array) by using two or more sets of brackets, such as String[][] names. Each element, therefore, must be accessed by a corresponding number of index values. In the Java programming language, a multidimensional array is an array whose components are themselves arrays.
🌐
Baeldung
baeldung.com › home › java › java string › array to string conversions
Array to String Conversions | Baeldung
September 16, 2026 - Similarly, we sometimes need to split a string into an array that contains some subset of input string split by the specified delimiter, let’s see how we can do this, too. Firstly, let’s start by splitting the whitespace using the String.split() method without a delimiter: ... Secondly, let’s look again at the StringUtils class from Apache’s Commons Lang library.
🌐
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
Here’s a complete source code example that demonstrates the syntax prior to Java 5: public class JavaStringArrayTests1 { private String[] toppings = {"Cheese", "Pepperoni", "Black Olives"}; // our constructor; print out the String array here public JavaStringArrayTests1() { // old `for` loop ...
🌐
TutorialKart
tutorialkart.com › java › java-array › java-string-array
Java String Array - Examples
November 23, 2020 - Following is the syntax to declare an Array of Strings in Java. ... You can use any of these two notations. To initialize a string array, you can assign the array variable with new string array of specific size as shown below. ... You have to mention the size of array during initialization. This will create a string array in memory, with all elements initialized to their corresponding static default value. The default value for a string is empty string “”. Following is an example program to initialize a string array of size 10.