Enum Types

  • Enum is thread safe
  • has own namespace
  • can use inside switch
  • constructor of Enum is private
  • adding new constant is easily
  • constants defined in Enum are implicitly static and final, can be compared with ==
  • Java generate values() method
  • Enum can implement interface
  • Abstract method can be defined in Enum

EnumMap
EnumSet

declare

use

get instance by name

get all values

How to get Enum Value from index in Java?

http://javarevisited.blogspot.com/2011/08/enum-in-java-example-tutorial.html

http://www.java67.com/2012/08/string-to-enum-in-java-conversion.html

javarush Enum

Leave a comment

Your email address will not be published. Required fields are marked *