[an error occurred while processing this directive]
Array Example - Array in Java
Array: Array is the most important thing in any programming language. By definition, array is the static memory allocation. It allocates the memory for the same data type in sequence. It contains multiple values of same types. It also store the values in memory at the fixed size. Multiple types of arrays are used in any programming language such as: one - dimensional, two - dimensional or can say multi - dimensional.
Declaration of an array:
In this program we will see how to declare and implementation. This program illustrates that the array working way. This program takes the numbers present in the num array in unordered list and prints numbers in ascending order. In this program the sort() function of the java.util.*; package is using to sort all the numbers present in the num array. The Arrays.sort() automatically sorts the list of number in ascending order by default. This function held the argument which is the array name num.
Here is the code of the program:-
Output of the program: