Online Java Compiler By
JavaTpoint.com
import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.ListIterator; public class JavaListIteratoraddExample2 { public static void main(String[] args) { List
li = new ArrayList<>(); Iterator
itr = null; li.add(66.9f); li.add(70.4f); li.add(34.6f); itr = li.listIterator(); System.out.println("The list is given as: "); while(itr.hasNext()){ System.out.println(itr.next()); } } }
Output