Enums are predefined place holders in Java. Knowing the contents of an enum will be handy in many instances
Let us look at how to navigate the elements of an enum
public class NavigatingAnEnum
{
public static void main(String args[])
{
NavigatingAnEnum navigatingAnEnum = new NavigatingAnEnum();
navigatingAnEnum.proceed();
}
enum Criteria {
LOW,
MEDIUM,
HIGH
}
private void proceed()
{
System.out.println(“Elements of the enum Criteria…”);
for (Criteria criteria : Criteria.values()) {
System.out.println(criteria);
}
}
}
/*
Expected output:
[[email protected]]# java NavigatingAnEnum
Elements of the enum Criteria…
LOW
MEDIUM
HIGH
*/