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

Code Example 1

//method 1
int[] age = new int[3];
        age[0] = 1;
        age[1] = 3;
        age[2] = 6;

        for (int i=0; i < 3; i++)
            System.out.println(age[i]);

//method 2
        int[] num = {3,3,5};
        //int num[] = {3,3,5}; also works the same

        System.out.println(num[0]);

Code Example 2

String[] cars = {"Volvo", "BMW", "Ford", "Mazda"};
cars[0] = "Opel";
System.out.println(cars[0]);
// Now outputs Opel instead of Volvo

Code Example 3

int[] intArray = new int[]{ 1,2,3,4,5,6,7,8,9,10 }; 
 // Declaring array literal

Code Example 4

//Metodo 1
type nome = new type[n];

//Metodo 2
type nome[];
nome = new type[n];

Code Example 5

// accessing the elements of the specified array
for (int i = 0; i < arr.length; i++)
  System.out.println("Element at index " + i + 
                                " : "+ arr[i]);

Code Example 6

int intArray[];    //declaring array
intArray = new int[20];  // allocating memory to array

Code Example 7

type nome[] = new type[n];

Code Example 8

int intArray[];    //declaring array
intArray = new int[10];  // allocating memory to array
intArray[0] = 10;	// Adding elements to the array
System.out.println(intArray[0]); // Accessing elements of array

Learn ReactJs, React Native from akashmittal.com