Online Java Compiler By
JavaTpoint.com
import java.util.LinkedList; import java.util.List; public class JavaListIndexOfExample3 { public static void main(String[] args) { List
list= new LinkedList<>(); list.add(67); list.add(89); // returns -1 if the no value is present in the specified index int value =list.indexOf(null); System.out.println("Element stored at "+null+" : "+value); } }
Output