The names.add() method is used to add an element to an ArrayList. It takes two parameters: the index at which you want to insert the element and the value (element) itself.
Related terms
IndexOutOfBoundsException: An exception that occurs when trying to access or modify an element at an invalid index (e.g., outside the range).
Insertion: Adding an element into a specific position within a data structure, such as inserting an item into an array at a given index.
Element: A single item/value stored within a data structure.