Online Java Compiler By
JavaTpoint.com
import java.util.*; public class VectorLastIndexOfExample3 { public static void main(String arg[]) { //Create a first empty vector Vector
vec = new Vector<>(4); //Add elements in the first vector vec.add("Facebook"); vec.add("Whatsapp"); vec.add("Twitter"); vec.add("Instagram"); vec.add("Skype"); //This would start searching of element in the backward direction from index -2 System.out.println("Index of element is found at: " +vec.lastIndexOf("Skype", 6)); } }
Output