Online Java Compiler By
JavaTpoint.com
import java.util.ArrayList; import java.util.Iterator; import java.util.List; public class JavaListIteratorhasNextExample1 { public static void main(String[] args) { List
li = new ArrayList<>(); Iterator
itr = null; li.add(66l); li.add(70l); li.add(21l); itr = li.listIterator(); System.out.println("The final list for long value is given as: "); while(itr.hasNext()){ System.out.println(itr.next()); } } }
Output