OneBite.Dev - Coding blog in a bite size

create an array of string in java

Code snippet on how to create an array of string in java

  String[] stringArray = { "hello", "world" };

This code creates an array of string in Java. The type of the array is a String, which is denoted by the first set of square brackets. To create the array, the code declares a variable called stringArray, which is assigned the values of the array by placing them within curly brackets. The individual elements of the array are separated by a comma (”,”) and are enclosed within double quotation marks (” ”). In this example, the array contains two elements: “hello” and “world”.

java