An exception is thrown, and (ordinarily) the program halts.
isEmpty()
The elementAt()
, removeElementAt()
,
and other methods will also throw an exception when the designated
element does not exist.
To check if a Vector
has elements use
boolean isEmpty()
which returns true
if the Vector
has no elements.