java.lang.Enum类 - java.lang
java.lang.Enum 类是所有Java语言枚举类型的公共基类。
类声明
以下是java.lang.Enum类的声明:
public abstract class Enum<E extends Enum<E>>
   extends Object
      implements Comparable<E>, Serializable
类构造函数
| S.N. | 构造函数 & 描述 | 
|---|---|
| 1 | protected Enum(String name, int ordinal) 这是一个构造函数。 | 
类方法
| S.N. | 方法 & 描述 | 
|---|---|
| 1 | protected Object clone() 此方法将抛出CloneNotSupportedException异常。 | 
| 2 | int compareTo(E o) 此方法比较此枚举与指定对象的顺序。 | 
| 3 | boolean equals(Object other) 如果指定的对象等于此枚举常量此方法返回true。 | 
| 4 | protected void finalize() 此方法返回枚举类不能有finalize方法。 | 
| 5 | Class<E> getDeclaringClass() 此方法返回对应于此枚举常量的枚举类型的Class对象。 | 
| 6 | int hashCode() 此方法返回枚举常量的哈希码。 | 
| 7 | String name() 此方法返回枚举常量的名称,正是因为在枚举声明中声明。 | 
| 8 | int ordinal() 此方法返回枚举常量的序数(它在枚举声明,其中初始常量分配的零序位)。 | 
| 9 | String toString() 此方法返回枚举常量的名称,它包含在声明中。 | 
| 10 | static <T extends Enum<T>> T valueOf(Class<T> enumType, String name) 此方法返回具有指定名称的指定枚举类型的枚举常量。 | 
方法继承
这个类从以下类继承的方法:
- java.lang.Object