Online Java Compiler By
JavaTpoint.com
import java.util.EnumSet; enum Colours{ red,green,blue,orange; } public class Enum_hashCodeMethodExample2 { public static void main(String[] args) { //printing hash codes with help of EnumSet EnumSet.allOf(Colours.class). forEach(Colours->System.out.println(Colours +" = "+Colours.hashCode())); } }
Output