Arrays are structures that allow us to collect more data in an ordered form. If we need to store 100 names or numbers instead of declaring 100 variables, we can use the array for that. In Java, there are both single and multidimensional arrays. The schematic declaration of a one-dimensional array is as follows:
The following is also correct:
By this entry: declaring and create an empty array of elements of the type “type” with the number of elements equal to “number_elements”. Of course, the type can be either numbers, characters, strings, or objects.
There is also another way to create an array if you know the elements right away: