Adding the element to the end of the vector.
The difference is that add() will always return true, while addElement() has no return value.
public boolean add(Object element) public void addElement(Object element)
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(i); } System.out.println(v); } }
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]