Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
Java Array Tutorial
Java Array is a fixed number collection of elements having same data type. In java array is an object. A java array can have primitives as well as object references.
Each and every element in an array is identified through a non negative number called index. The size of an array is fixed and can not be changed
An array has a final field called length, which denotes the number of elements an array can accommodate. The first element is always at index 0 and the last element at length – 1.
Declaring a Java array variable
An array can be declared using following syntax.
<type>  arrayName ;
<type> arrayName ;
Here type can be any primitive or reference type.
Note: Array size is not defined here. This array variable can be assigned to an array of any length.
Declaring an array variable does not actually create an array nor allocate any memory. It just creates a variable which can hold reference to the array.
An array variable declared as a member variable will be automatically initialized to default value null, while local array variable not.
Java Array Creation >>