The java.util.vector.elements() method of Vector class in Java is used to get the enumeration of the values present in the Vector.
Enumeration enu = Vector.elements()
Parameters: The method does not take any parameters.
Return value: The method returns an enumeration of the values of the Vector.
Below programs are used to illustrate the working of the java.util.Vector.elements() method:
The Vector is: [Geeks, 4, Geeks, Welcomes, You] The enumeration of values are: Geeks 4 Geeks Welcomes You
Program 2 :
The Vector is: [10, 15, 20, 25, 30] The enumeration of values are: 10 15 20 25 30
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.