Online Java Compiler By
JavaTpoint.com
import java.util.*; public class VectorSubListExample3 { public static void main(String arg[]) { //Create an empty vector Vector
vec = new Vector<>(); //Add elements in the vector vec.add(10); vec.add(20); vec.add(30); //Use subList() method to get subList of the vector List
subList = vec.subList(6,2); //Display sublist vector list System.out.println("Sublist elements :"+subList); } }
Output