Online Java Compiler By
JavaTpoint.com
import java.util.*; public class VectorRemoveRangeExample2 extends Vector { public static void main(String arg[]) { //Create object for vector class VectorRemoveRangeExample2 vec=new VectorRemoveRangeExample2(); //Add an elements in vector vec.add("w"); vec.add("e"); vec.add("l"); vec.add("l"); vec.add("d"); vec.add("c"); vec.add("o"); vec.add("m"); vec.add("e"); //Displaying the vector element before removal System.out.println("Vector elements: "+vec); //Remove elements from between given index range values vec.removeRange(3,5); //Displaying the vector element after removal System.out.println("Vector elements after removal: "+vec); } }
Output