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