The concept of enum types:
1 /**2 * Purpose: Enum type3 * @authorChenyanlong4 * Date: 2017/10/225 * Website:http://blog.csdn.net/sup_heaven/article/details/352958516 */7 PackageCom.mon10.day22;8 9 Public classEnumdemoone {Ten One //declaring enum types A Private enuminnerenum{ - Red,green,yellow - }; the - Public Static voidMain (string[] args) { - System.out.println (innerenum.green); - } +}
Run the above code to produce the edits Enumdemoone.class and Enumdemoone$innerenum.class.
This means that defining an enumeration type is actually defining a class, except that a lot of details are being filled by the compiler, so To some extent, the enum keyword acts like a class or interface. When you use an enum to define an enumeration type, the type that is actually defined is inherited from the Java.lang.Enum class. each enumerated member is actually an instance of the defined enumeration type, and they are all default to final. The values set by the constant name cannot be changed, and they are also members of public and Static, which is the same as the constant limit in the interface. They can be used directly from the class name.
Java Basics Learning--------enum type (1)