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

Code Example 1

int[] data = {10,20,30,40,50,60,71,80,90,91};
// or
int[] data;
data = new int[] {10,20,30,40,50,60,71,80,90,91};
// or
int[] data = new int[10];
data = {10,20,30,40,50,60,71,80,90,91};

Code Example 2

int[] arr = new int[10];	//Can hold 10 elements

Code Example 3

int intArray[];    //declaring array
intArray = new int[20];  // allocating memory to array
//OR
int[] intArray = new int[20]; // combining both statements in one

Code Example 4

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

Code Example 5

int[] array=new int[5];
int[] array2=new int[]{1,2};

Learn ReactJs, React Native from akashmittal.com