The reason for this has to do with how the ArrayList is implemented. Variables in Java can be divided into two categories: value type (primitive) and reference type (reference type) variables.
Differences between Arrays and ArrayLists. In Java, arrays are used to store multiple items of the same type in one place. They have a fixed size, meaning you decide how many items they can hold when ...