An array in Java is a fixed-size data structure used to store multiple values of the same data type under a single variable name.
Arrays can be declared first and initialized later, or both can be done in a single statement.
// Declaring an integer array
int[] numbers;
// Allocating memory for 5 integers
numbers = new int[5];
// Array creation and initialization
int[] marks = {85, 90, 78, 92, 88};
// Accessing array elements using index
System.out.println(marks[0]);
System.out.println(marks[3]);
85
92
The program prints values stored at index 0 and index 3 of the array.
Create your own array and practice accessing elements by index.