An array is a group of like-typed or similar typed variables that are referred to by a common name.
Any type of arrays can be created and it can have one or more dimensions.Array index is used
for accessing any specific element.Using array is more convenient as it helps in grouping related information.
A list of like-typed variables are called as one-dimensional arrays. To create an array, you first
need to create an array variable of the desired type. The general form of a one-dimensional
array declaration is
data_type variable_name[ ];
// Declaration of an array
int array = new int;
//Display array elements
//Using for loop to display elements
for (int i = 0; i < array.length; i++)
//println is used to print line in another line
In Java, multidimensional arrays are actually arrays of arrays.To declare a multidimensional array variable,
specify each additional index using another set of square brackets. For example, the following declares a two dimensional
array variable called value.
int val = new int;
This allocates a 4 by 5 array and assigns it to value. Internally this matrix is implemented as
an array of arrays of int.
Example : This example shows how to declare initialize and display multi dimensional array.
// Declaration of multi dimensional array
int multiarray = new int;