Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;

public class Main {
    public static void main(String args[]) {
        // create array list object       
        List<String> arrlist = new ArrayList<String>();

        // populate the list
        arrlist.add("A");
        arrlist.add("B");
        arrlist.add("from java2s.com");

        // create Enumeration
        Enumeration<String> e = Collections.enumeration(arrlist);

        while (e.hasMoreElements()) {
            System.out.println("Value is: " + e.nextElement());
        }
    }
}