Java Arrays are used to store multiple values in a single variable.
Example:
String[] fruits = {"Apple", "Cherry", "Grape", "Cherry"};
Array of integers values
you can store all integers values
example:
int[] my_nums= {100, 120, 130, 40};
How to access the array elements?
you can access element through index number
example:
String[] fruits = {"Apple", "Cherry", "Grape", "Cherry"};
System.out.println(fruits [0]);
Output:
Apple |