If you make the size smaller than the current number of elements, the vector drops elements from the end.
Increasing the size adds null elements to the end.
Calling setSize(0) removes all elements from the vector.
If you set the size to zero or have no elements in the vector, the isEmpty() method returns true:
public boolean isEmpty()
import java.util.Vector;
public class MainClass { public static void main(String args[]) {
Vector v = new Vector(5); for (int i = 0; i < 10; i++) {
v.add(0,i);
}
System.out.println(v);