Java tutorial
import java.util.Vector; public class Main { public static void main(String[] args) { // create two empty Vectors firstvec and secondvec Vector<Integer> firstvec = new Vector<Integer>(4); Vector<Integer> secondvec = new Vector<Integer>(4); // use add() method to add elements in the secondvec vector secondvec.add(5); secondvec.add(6); secondvec.add(7); secondvec.add(8); // use add() method to add elements in the firstvec vector firstvec.add(1); firstvec.add(2); firstvec.add(3); firstvec.add(4); // use addAll() method to add secondvec with firstvec vector firstvec.addAll(secondvec); // let us print all the elements available in vector firstvec vector System.out.println("Added numbers are :- "); System.out.println(firstvec); } }