Numbers.java Source code

Java tutorial

Introduction

Here is the source code for Numbers.java

Source

import java.util.EnumSet;

enum Numbers {

    ONE, TWO, THREE, FOUR, FIVE
};

public class Main {

    public static void main(String[] args) {

        EnumSet<Numbers> set1 = EnumSet.allOf(Numbers.class);

        System.out.println("Set1:" + set1);

        // create a second set which is a copy of set1
        EnumSet<Numbers> set2 = EnumSet.copyOf(set1);

        System.out.println("Set2:" + set2);

    }
}