Online Java Compiler By
JavaTpoint.com
import java.util.*; public class VectorRemoveElementAtExample1 { public static void main(String arg[]) { //Create an empty vector Vector
vec = new Vector<>(); //Add elements in the vector vec.add(1); vec.add(2); vec.add(3); vec.add(4); vec.add(5); vec.add(6); //Displaying the vector element System.out.println("Vector element before removal: " +vec); //Remove an element vec.removeElementAt(5); //Displaying the vector element again System.out.println("Vector element after removal: " +vec); } }
Output