Answer:
0, just as with an array.
Summary List<E> Interface
Here is a summary of the List<E> Interface.
For the full interface see your Java documentation.
| Method | What it Does |
|---|---|
boolean add(E elt) | Appends element elt to the end of the list. |
void add(int index, E elt) | Inserts element elt at the specified index. |
E get(int index) | Returns a reference to the element at the specified index. |
int indexOf(Object elem) | Searches for the first occurence of elem,
testing for equality using the equals(Object) method. |
E set(int index, E elt) | Replaces the element at index with the specified element elt. |
| . . . many more . . . | . . . |
The methods are described in terms of the type
reference to E that the list contains.
QUESTION 10:
Say that you have an ArrayList of references to String.
What does the add() method look like?