arrays Java create an array with initial values


Example

public class CreateArrayWithValues {
    public static void main(String[] args){
        // Initializes an array of Strings with values
        String[] myArray = {"this", "array", "has", "six", "initial", "values"};
        System.out.println("myArray.length = "+myArray.length);
        // Print out each value of myArray
        for(int index = 0; index < myArray.length; index++){
            System.out.print(myArray[index]);
        }
    }
}