You need to initialize errorSoon, as indicated by the error message, you have only declared it.

Use with AIString[] errorSoon;                   // <--declared statement
String[] errorSoon = new String[100]; // <--initialized statement

You need to initialize the array so it can allocate the correct memory storage for the String elements before you can start setting the index.

If you only declare the array (as you did) there is no memory allocated for the String elements, but only a reference handle to errorSoon, and will throw an error when you try to initialize a variable at any index.

As a side note, you could also initialize the String array inside braces, { } as so,

Use with AIString[] errorSoon = {"Hello", "World"};

which is equivalent to

Use with AIString[] errorSoon = new String[2];
errorSoon[0] = "Hello";
errorSoon[1] = "World";
Answer from Anthony Forloney on Stack Overflow
๐ŸŒ
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.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ java โ€บ string-arrays-in-java
String Arrays in Java - GeeksforGeeks
October 2, 2025 - // Java program to demonstrate ... "good", "girl" }; // Create a StringBuilder to build the resulting string StringBuilder sb = new StringBuilder(); // Append the first element of the array to the StringBuilder sb.append(arr[0]); ...
๐ŸŒ
Techie Delight
techiedelight.com โ€บ home โ€บ java โ€บ initialize an array of string in java
Initialize an array of String in Java | Techie Delight
July 7, 2026 - 1. We can declare and initialize an array of string in Java by using a new operator with an array initializer.
๐ŸŒ
TutorialKart
tutorialkart.com โ€บ java โ€บ how-to-initialize-string-array-in-java
How to Initialize String Array in Java?
January 12, 2021 - To initialize String Array in Java, define a string array and assign a set of elements to the array, or define a string array with specific size and assign values to the array using index.
Find elsewhere
๐ŸŒ
CodeGym
codegym.cc โ€บ java blog โ€บ java arrays โ€บ string array in java
String Array in Java
May 11, 2023 - Today we are going to look at string arrays in Java language, that is, arrays, each element of which is a string. We'll figure out how to declare Java String Array and how to work with it. You can declare and initialize a String array in Java in different ways.
๐ŸŒ
Codemia
codemia.io โ€บ home โ€บ knowledge hub โ€บ java how to initialize string[]?
Java how to initialize String[]? | Codemia
January 27, 2025 - There are multiple ways to initialize a String[] in Java: At declaration: This method involves directly specifying the elements of the array at the time of its declaration.
๐ŸŒ
Software Testing Help
softwaretestinghelp.com โ€บ home โ€บ java โ€บ java string array- tutorial with code examples
Java String Array- Tutorial With Code Examples
April 1, 2025 - This tutorial on Java String Array explains how to declare, initialize & create String Arrays in Java and conversions that we can carry out on String Array.
๐ŸŒ
W3docs
w3docs.com โ€บ home โ€บ code snippets โ€บ java โ€บ java: how to initialize string[]?
Java: how to initialize String[]? | W3docs
Here are a few examples: // method 1: using an array literal String[] arr1 = {"apple", "banana", "cherry"}; // method 2: using the new operator String[] arr2 = new String[] {"apple", "banana", "cherry"}; // method 3: using the new operator and ...
๐ŸŒ
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.
๐ŸŒ
Hero Vired
herovired.com โ€บ learning-hub โ€บ blogs โ€บ string-array-in-java
String Array in Java: How to Declare, Example, Initializing
October 7, 2024 - Java String Arrays are a powerful data type in Java that can store an array of strings. They can be initialized with literal values, dynamically created, or parsed from a string using the split() method.
๐ŸŒ
freeCodeCamp
freecodecamp.org โ€บ news โ€บ java-array-how-to-declare-and-initialize-an-array-in-java-example
Java Array โ€“ How to Declare and Initialize an Array in Java Example
February 4, 2022 - String[] names = {"John", "Jade", "Love", "Allen"}; ... We have initialized our arrays by passing in values with the same data type with each value separated by a comma. If we wanted to access the elements/values in our array, we would refer ...
๐ŸŒ
Sentry
sentry.io โ€บ sentry answers โ€บ java โ€บ how to initialize an array in one line in java
Java Initialize an Array in One Line with Examples | Sentry
September 17, 2026 - public class Main { public static void main(String[] args) { String[] words = new String[4]; words[0] = "java"; words[1] = "arrays"; words[2] = "are"; words[3] = "easy"; System.out.println(words[0]); System.out.println(words[1]); } } However, sometimes you have all the data you need when you initialize the array, and you want to initialize the array using less code.
๐ŸŒ
Mathbits
mathbits.com โ€บ JavaBitsNotebook โ€บ Arrays โ€บ Initialize.html
Java Initialize Arrays - JavaBitsNotebook.com
When an array is declared, a sufficient amount of memory is set aside to hold the elements. The array is then initialized to the default values for the element type. For example, โ€ข if the elements in the array are integers (int), each element in the array will be automatically initialized ...
๐ŸŒ
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 - Example: String[] fruits = {"Apple", "Banana", "Cherry"};. This both declares and initializes the array with predefined values. No, arrays in Java are fixed in size once declared.