Java - Array Java Arrays

What Is an Array?

An array is a fixed-length data structure which can hold more than one value of the same data type.

All elements of an array are stored contiguously in memory.


Placing [] after the data type or after the variable name in a variable declaration.

int[] empId;


int empId[];

The following are more examples of array declarations:

// salary can hold multiple float values
float[] salary;

// name can hold multiple references to String objects
String[] name;

// emp can hold multiple references to Employee objects
Employee[] emp;

Related Topics