A good answer might be:

Each slot holds a reference to an Object.


Phone Book Application

class Entry
{
  String name;
  String number;

  // constructor
  Entry( String n, String num )
  {
    name = n; number = num;
  }

  // various methods
  . . .
}

Vectors 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.


QUESTION 19:

Suggest two methods that will be useful for Entry.