ArrayLists and arrays

Arrays and ArrayLists are examples of structured data types: they can store multiple elements in order, and the elements can be accessed by their indices. Earlier in the course we encountered Strings. A String is similar in that it contains multiple elements (the characters) and they can be accessed by their indices (using the charAt method). However, unlike Strings, arrays and ArrayLists are mutable, that is, their contents can be modified after construction.

Here is a brief comparison of some of the features of arrays and ArrayLists.

ArrayLists

Arrays