请问在api文档中类Enum没有values()这个方法,为什么在以下代码中却能调用它呢?
public enum Direction{L,LU,U,RU,R,RD,D,LD,STOP};
Direction[] dirs = Direction.values();

解决方案 »

  1.   

    LZ可以看一下,java.lang.annotation.ElementType的javadoc
    java.lang.annotation
    Enum ElementTypejava.lang.Object
      extended by java.lang.Enum<ElementType>
          extended by java.lang.annotation.ElementTypeAll Implemented Interfaces:
        Serializable, Comparable<ElementType> 这个里面有:
    static ElementType[]  values()
              Returns an array containing the constants of this enum type, in the order they are declared.
      

  2.   

    大家好,我是新手,请问为什么我在api文档中找不到“java.lang.Object 
      extended by java.lang.Enum <ElementType> 
          extended by java.lang.annotation.ElementType”和
    “All Implemented Interfaces: 
        Serializable, Comparable <ElementType> ”的信息?