Online Java Compiler By
JavaTpoint.com
import java.util.*; public class VectorRemoveExample1 { public static void main(String arg[]) { //Create an empty Vector Vector < Integer > in = new Vector < > (); //Add elements in the vector in.add(100); in.add(200); in.add(300); in.add(200); in.add(400); System.out.println("Values in vector: " +in); System.out.println("Remove first occourence of element 200: "+in.remove((Integer)200)); System.out.println("Values in vector: " +in); } }
Output