@@ -0,0 +1,543 @@
+// Use the built-in enumeration methods.%0A%0A// An enumeration of Transport varieties.%0Aenum Transport %7B%0A%09CAR, TRUCK, AIRPLANE, TRAIN, BOAT%0A%7D%0A%0Aclass EnumDemo2 %7B%0A%09public static void main(String args%5B%5D) %7B%0A%09%09Transport tp;%0A%09%09%0A%09%09System.out.println(%22Here are all Transport constants%22);%0A%09%09%0A%09%09// use values()%0A%09%09Transport allTransports%5B%5D = Transport.values();%0A%09%09for(Transport t : allTransports)%0A%09%09%09System.out.println(t);%0A%09%09%0A%09%09System.out.println();%0A%09%09%0A%09%09// use valueOf()%0A%09%09tp = Transport.valueOf(%22AIRPLANE%22);%0A%09%09System.out.println(%22tp contains %22 + tp);%0A%09%7D%0A%7D%0A

Use built-in enumeration methods