We would like to know how to compare enum members: == or equals().
//from ww w. ja v a2s .co m enum TestEnum { ONE, TWO, THREE } public class Main { public static void main(String[] args) { for (int y = 0; y < 5; ++y) { for (int x = 0; x < Integer.MAX_VALUE; ++x) { if (TestEnum.ONE.equals(TestEnum.TWO)) { System.out.println("equals"); } if (TestEnum.ONE == TestEnum.TWO) { System.out.println("=="); } } } } }