Java: Enums

(Last Updated On: )

Below is an example of how to create a enum in Java.

public enum MyEnum {
	VAL(0), NEXTVAL(1);

	private int value;

	private MyEnum(int value) {
		setValue(value);
	}

	public int getValue() {
		return value;
	}

	public void setValue(int value) {
		this.value = value;
	}
}