what is enum java code example

Example 1: java enum

public class DaysOfTheWeek {

    public enum Days {m, t, w, r, f, sat, s};
  	    public static void main(String[] args) {
          Days d = Days.t; 
          System.out.println(d);
          //the output would be t
        }
}

Example 2: enum with methods in java example

public enum Level {
    HIGH{
        @Override
        public String asLowerCase() {
            return HIGH.toString().toLowerCase();
        }
    },
    MEDIUM{
        @Override
        public String asLowerCase() {
            return MEDIUM.toString().toLowerCase();
        }
    },
    LOW{
        @Override
        public String asLowerCase() {
            return LOW.toString().toLowerCase();
        }
    };

    public abstract String asLowerCase();
}