Monday, 25 May 2015

How To Remove Element of Vector

import java.util.Vector;

public class RemoveElement {

    public static void main(String[] args) {
        Vector<String> vector = new Vector<String>();
        //add element in vector
        // print vector
        System.out.println("Vector = "+vector);
         * Removes the element at the specified position
         * in this Vector. Shifts any subsequent elements
         * to the left (subtracts one from their indices).
         * Returns the element that was removed from the
         *  Vector.
        System.out.println("After remove element vector is = "+vector);


Vector = [cricket, hockey, football, tennish]

After remove element vector is = [cricket, football, tennish]

No comments:

Post a Comment