ArrayList Class of Collections

Figure 2.10:
Image javaarraylist

The ArrayList class allows us to create resizable arrays. The class implements the List interface (which is a subinterface of the Collection interface).


\begin{lstlisting}
// The Collections framework is defined in the java.util pack...
...se'');
\par
System.out.println(''ArrayList: '' + animals);
}
}
\end{lstlisting}

The output for the above code block looks like ArrayList: [Dog, Cat, Horse]