Enum
public enum Day
{
	Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday
}
			
//internal implementation of Day
public enum Day
{
	public static final Day Monday = new Day();
	public static final Day Tuesday = new Day();
	public static final Day Wednesday = new Day();
	public static final Day Thursday = new Day();
	public static final Day Friday = new Day();
	public static final Day Saturday = new Day();
	public static final Day Sunday = new Day();
}
			
public class E
{
	public static void main(String args[])
	{
		Day d = Day.Monday;

		System.out.println(d);

		//valueOf
		System.out.println(d.valueOf("Sunday"));

		//values
		for(Day e : Day.values())
			System.out.println(e);

		System.out.println(Day.Saturday.ordinal());
	}
}
			
main method in enum
public enum Day
{
	Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday;

	public static void main(String args[])
	{
		Day d = Day.Sunday;

		System.out.println(d);
	}
}
			
enum and constructors
public enum Car
{
	Camery("Toyota", 2010),
	Accord("Honda", 2016),
	Acura("Honda", 2000),
	Century("Buick", 1998);

	private final String maker;
	private final int year;

	Car(String m, int y)
	{
		maker = m;
		year = y;
	}

	public String getMaker()
	{
		return maker;
	}

	public int getYear()
	{
		return year;
	}
}
			
public class CarTest
{
	public static void main(String args[])
	{
		for(Car b : Car.values())
			System.out.printf("%s: %s %d\n", b, b.getMaker(), b.getYear());

		Car c = Car.Accord;

		System.out.printf("%s %d\n", c.getMaker(), c.getYear());
	}
}
			
Access enum with index
public class E
{
	public static void main(String args[])
	{
		//index
		for(int i = 0, len = Day.values().length; i < len; i++)
			System.out.println(Day.values()[i]);
	}
}
			
Compare enum objects
public class E
{
	public static void main(String args[])
	{
		Day a = Day.Monday;
		Day b = Day.Tuesday;

		if(a.compareTo(b) < 0)
			System.out.printf("%s < %s\n", a, b);
	}
}
			
Reference