One dimensional array shows how to declare initialize and display an array.


// Declaration of allocating memory to an array
int iarr[] = new int[3];

// Initializing elements
iarr[0] = 1;
iarr[1] = 2;
iarr[2] = 3;

//Display array elements
System.out.println(iarr[0]);
System.out.println(iarr[1]);
System.out.println(iarr[2]);

// Or Use for loop to display elements
for (int i = 0; i < iarr.length; i = i + 1)
{
System.out.print(iarr[i]);
System.out.print(" ");
}

We Are Founder..