«
^
»
5.1 Using an ArrayList
You can store objects of any class in an
ArrayList
.
Usually, the objects you store in an
ArrayList
will all be of the same class: this is called a
homogeneous list
.
However, occasionally you will want a mix.
So let us add a
Date
object to this
ArrayList
:
0165: Date tDate = new Date(); 0166: tList.add(tDate);
You can do this because
add
has a parameter of type
Object
.