public static void main(String[] args) { for (TestEnum e : TestEnum.values()) { e.test(); } TestEnum e1 = TestEnum.valueOf("E"); e1.test(); }