Online Java Compiler By
JavaTpoint.com
import java.util.*; public class VectorRemoveExample2 { public static void main(String arg[]) { //Create an empty Vector Vector
vector = new Vector<>(); //Add elements to the Vector vector.add("Java"); vector.add("Android"); vector.add("JavaScript"); vector.add("Java"); //Display the elements of the Vector System.out.println("Elements of the Vector before remove: "+vector); //Removing the Java from the Vector boolean b = vector.removeElement("Java"); System.out.println("Is the removal successful? "+b); //Printing the elements of the Vector System.out.println("Elements of the Vector after remove: "+vector); } }
Output