Java examples for Language Basics:enum
List Enum Constants
public class Main { public static void main(String[] args) { for(Level s : Level.values()) { String name = s.name();/* w ww. java 2 s .com*/ int ordinal = s.ordinal(); System.out.println(name + "(" + ordinal + ")"); } } } enum Level { LOW, MEDIUM, HIGH, URGENT; }