Online Java Compiler By
JavaTpoint.com
import java.util.ArrayList; import java.util.Iterator; import java.util.List; public class JavaListIteratorhasNextExample2 { public static void main(String[] args) { List
li = new ArrayList<>(); Iterator
itr = null; li.add('a'); li.add('e'); li.add('i'); li.add('o'); li.add('u'); itr = li.listIterator(); System.out.println("The final list for the characters is given as: "); while(itr.hasNext()){ System.out.println(itr.next()); } } }
Output