A Vector is Like an Array
A Vector can be used essentially like an ordinary array.
It has a well-defined current size, returned by the size() inquiry. This can be set with setSize() (but usually grown using methods on next slide).
Vector stores all elements as if the have type Object
If 0 < idx < size(), the methods:
void set(int idx, Object obj)
Object get(int idx)
respectively assign and retrieve value of element idx..
- Also have equivalent but older-style interfaces:
void setElementAt(Object obj, int idx)
Object elementAt(int idx)
Note: when we get on to GUIs we will use DefaultListModel, which is similar to Vector but only has old-style methods.