String[] list = new String[3];
list[3] = "dog" ;
An ArrayIndexOutOfBounds exception is thrown and
(ordinarily) the program halts.
Vector class
The Vector class builds upon the capabilities of arrays.
A Vector object contains an array of object references
plus many methods for managing that array.
The biggest convenience of a Vector is that you can
keep adding elements to it no matter what size it was originally.
The size of the Vector will automatically increase
and no information will be lost.
However, this convenience comes at a small price:
Vector must be object references,
not primitive data like int or double.Vector operations are slighly slower than using
an array.