Array in Java


☞An array is a structure created in memory to represent group of similar type of elements with the variables having the same variable name along with different subscripts.

☞A dimensional array is also known as Subscripted Variable.

☞It is said to be a non-primitive data type. As you know that non-primitive datatype represents group of similar or different data under single declaration.

☞Array is index based, first element of the array is stored at 0 index.

☞Suppose we have an array of 5 elements with name arr, it will be represented diagramatically as shown below.

☞In above figure,

arr[0] = 10
arr[1] = 87
arr[2] = 76
arr[3] = 98   
arr[4] = 56

☞A dimensional array is basically of two types.

1. Single Dimensional Array
2. Double Dimensional Array

Note :
1. We can store only fixed size of elements in the array. It doesn't grow its size at runtime.
2. We can access any data located at any index position.
3. While creating an array one more variable is created automatically with name length, which stores the size of that array.