Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public enum introToEnum {
- //enum is converted to class internally.
- //all enums extend java.lang.Enum class. so it cannot extend anything else.
- ELSS("ELSS"),
- //this means ELSS is one of the enum.
- // this gets converted to --> public static final introToEnum ELSS = new introToEnum("ELSS");
- UNKNOWN("UNKNOWN");
- private final String value;
- //we can have instance variables.
- introToEnum(String value) {
- this.value = value;
- }
- //this is private constructor. so enum can't be instantiated.
- //this is invoked for each enum value.
- public String getValue() {
- return value;
- }
- //we can only have concrete methods inside enum.
- }
Add Comment
Please, Sign In to add comment