Online Java Compiler By
JavaTpoint.com
import java.util.*; public class VectorRemoveRangeExample1 extends Vector { public static void main(String arg[]) { //Create object for vector class VectorRemoveRangeExample1 vec = new VectorRemoveRangeExample1(); //Add elements in the vector vec.add(9); vec.add(8); vec.add(7); vec.add(6); vec.add(5); //Displaying the vector element before removal System.out.println("Vector element before removal: " +vec); //Remove the range of an element vec.removeRange(1,3); //Displaying the vector element after removal System.out.println("Vector element after removal: " +vec); } }
Output