
enum Apple {
	// each constant implicitly declared as public static final member
	Jonathan, GoldenDel, RedDel, Winesap, Cortland
}

public class EnumDemo {

	public static void main(String[] args) {
		Apple myapple = Apple.Cortland;

		// myapple = "somevalue"; // error

		System.out.println("Value of myapple: " + myapple);

		// get list of constants from enum
		// use values()
		Apple[] apples = Apple.values();
		for (Apple a : apples) {
			System.out.println(a);
		}
		
		// use valueOf()
		myapple = Apple.valueOf("Winesap");
		System.out.println("myapple contains " + myapple);
	}
}
