This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Context usage: "A type-safe enum pattern". My understanding of the term "type-safe" is that if a method expect type A, the compiler will throw an exception is a term that is not assignable to A is passed in? Any other characteristics? Thanks Pho
The compiler will also be able to catch an invalid assignment of the enumerated type to a variable of another type and vice versa. These "pros" of typesafe enums are from "Effective Java" by Joshua Bloch: - Constants may be added to a typesafe enum without recompiling its clients because the public static object reference fields containing the enumeration constants provide a layer of insulation between client and the enum class. - Because they are full-fledged classes, you can override the toString method, internationalize them, or augment them with any method that seems appropriate.
------------------ Junilu Lacar Sun Certified Programmer for the Java� 2 Platform