The java.util Vector class is a dynamic array that can be used to store objects. It provides many methods that allow you to add, remove, and manipulate elements in the collection.
Example code:
Vector vector = new Vector<>(); vector.add("apple"); // add an element to the vector vector.add("banana");
System.out.println(vector.get(0)); // prints "apple" System.out.println(vector.size()); // prints 2
vector.remove(1); // remove the second element System.out.println(vector.size()); // prints 1
// determine the package library The java.util package is part of the standard Java library and contains many useful classes including Vector.
Java Vector.add - 30 examples found. These are the top rated real world Java examples of java.util.Vector.add extracted from open source projects. You can rate examples to help us improve the quality of examples.