美文网首页
枚举类型的比较

枚举类型的比较

作者: 泰兰德的加长香蕉 | 来源:发表于2018-09-22 11:01 被阅读0次

    Enumeration  is actually a class. The class has exactly fixed member of instances—it is not possible to construct new objects.

    Therefore, you never need to use equals for values of enumerated types. Simply use == to compare them.

    You can, if you like, add constructors, methods, and fields to an enumerated type. Of course, the constructors are only invoked when the enumerated constants are constructed.

    相关文章

      网友评论

          本文标题:枚举类型的比较

          本文链接:https://www.haomeiwen.com/subject/wegtoftx.html