in.java Source code

Java tutorial

Introduction

Here is the source code for in.java

Source

FileShortTitle:Store enum in ArrayList
FileLongTitle:Store enum in ArrayList
FileTag:
===
SectionShortTitle:Question
SectionLongTitle:Question
SectionContent:


<p>We would like to know how to 
store enum in ArrayList.</p>


===
SectionShortTitle:Answer
SectionLongTitle:Answer
SectionContent:




<myPreCode>
import java.util.ArrayList;
import java.util.List;

public class Main {

    public static void main (String[] args) {
        List<MyEnum> enums = new ArrayList<MyEnum>();
    }

    enum MyEnum { ONE, TWO, THREE;}
    //         no need for that  ^ but added to match your question
}
</myPreCode>



===