public class EnumTest { public static void main(String[] args) { Fruit aFruit; Fruit anotherFruit; aFruit = Fruit.ORANGE; anotherFruit = Fruit.ORANGE; if (aFruit.equals(anotherFruit)) { System.out.println(aFruit + " equals " + anotherFruit); } else { System.out.println(aFruit + " does not equal " + anotherFruit); } anotherFruit = Fruit.APPLE; if (aFruit.equals(anotherFruit)) { System.out.println(aFruit + " equals " + anotherFruit); } else { System.out.println(aFruit + " does not equal " + anotherFruit); } System.out.println(); System.out.println("Here are all the fruits:"); for (Fruit f : Fruit.values()) { System.out.print(f + " "); } System.out.println("\n"); System.out.println("The Fruit object with the value ORANGE is " + Fruit.valueOf(Fruit.class, "ORANGE")); } }