Check out example codes for "set array length java". It will help you in understanding the concepts better.

Code Example 1

int[] array;

// is equivalent to

int array[];

Code Example 2

int[] array1 = new int[5]; //int array length 5
String[] array2 = new String[5] //String array length 5
double[] array3 = new double[5] // Double array length 5

Code Example 3

int[] theNumbers = new int[5];

arr[0] = 4;
arr[1] = 8;
arr[2] = 15;
arr[3] = 16;
arr[4] = 23;
arr[5] = 42;

Code Example 4

int[] age = new int[5];

Code Example 5

int[] num = new int[5];

Code Example 6

int[] intArray = new int[]{ 1,2,3,4,5,6,7,8,9,10 }

Learn ReactJs, React Native from akashmittal.com