Each slot holds a reference to an Object
.
class Entry { String name; String number; // constructor Entry( String n, String num ) { name = n; number = num; } // various methods . . . }
Vector
s are especially convenient when you want
to maintain a list of your own object types.
Since all classes,
even those of your own invention,
descend from the Object
class,
a Vector
can be used with objects of any type.
For example say that you wanted an application that maintained
a phone book.
Each entry in the phone book will contain
a name
and a number
,
along with various methods.