The Vector class implements a growable array of objects. It is available in java.util package. It implements the List interface. The Enumeration interface defines the methods by which you can traverse the elements in a collection of objects. Now in order to add elements
public class Vector<E> extends AbstractList<E> implements List<E>, RandomAccess, Cloneable, Serializable
java.util.Enumeration interface is one of the predefined interfaces, whose object is used for retrieving the data from collections framework variable( like Stack, Vector, HashTable, etc.) in a forward direction only and not in the backward direction.
You can use the Java.util.Vector.addElement() method to append a specified element to the end of this vector by increasing the size of the vector by 1. The functionality of this method is similar to that of the add() method of the Vector class.
boolean addElement(Object element)
Parameters: This function accepts a single parameter element of object type and refers to the element specified by this parameter is appended to the end of the vector.
Return Value: This is a void type method and does not return any value.
Welcome To Geeks for Geeks
1 2 3 4
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.