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