1int[] array1 = new int[5]; //int array length 5
2String[] array2 = new String[5] //String array length 5
3double[] array3 = new double[5] // Double array length 5
4
1int[] theNumbers = new int[5];
2
3arr[0] = 4;
4arr[1] = 8;
5arr[2] = 15;
6arr[3] = 16;
7arr[4] = 23;
8arr[5] = 42;
1/**
2* An Example to get the Array Length is Java
3*/
4public class ArrayLengthJava {
5public static void main(String[] args) {
6String[] myArray = { "I", "Love", "Music" };
7int arrayLength = myArray.length; //array length attribute
8System.out.println("The length of the array is: " + arrayLength);
9}
10}
11