How to define a string array in Java?
In Java, you can define a string array using the following syntax:
String[] arrayName = new String[length];
The arrayName is the name of the array, and length is the size of the array.
For example, a string array with a length of 3 can be defined like this:
String[] fruits = new String[3];
This defines a string array named “fruits” that can hold 3 string elements.