Online Java Compiler By
JavaTpoint.com
import java.util.*; public class CollectionsEnumerationExample3 { @SuppressWarnings("unchecked") public static void main(String[] args) { ArrayList firstList = new ArrayList(); firstList.add(101); firstList.add("Hello"); firstList.add("World"); firstList.add(true); firstList.add(101.5); Enumeration
e = Collections.enumeration(firstList); System.out.print("Elements using Enumeration: "); while(e.hasMoreElements()) { Object obj = e.nextElement(); System.out.print(obj + " "); } } }
Output