enum concept was introduced in java 1.5. enum is used to represent a group of constants.

A Simple enum class can be declared as below:

package com.masterjavatutorial;
public enum MONTHS {
	 
	JAN,FEB,MAR,APR,MAY,JUNE,JULY,
        AUG,SEP,OCT,NOV,DEC;

	public static void main(String args[]){
	   MONTHS[] values = MONTHS.values(); 
	   for(MONTHS value : values){
		System.out.println(value); 
	   }
	}
	  
}

Rules for Syntax of enum

There are some rules for syntax of enum classes. They are as below:

(I.) Semicolon in enum class is optional if only constants are declared.
e.g.

package com.masterjavatutorial;
public enum MONTHS {
    //Compiles fine. No error
   JAN,FEB,MAR,APR,MAY,JUNE,JULY,AUG,SEP,OCT,NOV,DEC
	  
}

This is perfectly valid.

(II.) Semicolon is mandatory if any method or constructor is declared.
e.g.
The below one will give compile-time error as semicolon is missing.

package com.masterjavatutorial;
public enum MONTHS {
        //compile-time error as semicolon is missing
	JAN,FEB,MAR,APR,MAY,JUNE,JULY,AUG,SEP,OCT,NOV,DEC
	public static void main(String args[]){
	    MONTHS[] values = MONTHS.values(); 
	    for(MONTHS value : values){
		System.out.println(value); 
	    }
	}
	  
}

The below code will compile fine as semicolon is put.

package com.masterjavatutorial;
public enum MONTHS {
	JAN,FEB,MAR,APR,MAY,JUNE,JULY,AUG,SEP,OCT,NOV,DEC;
	public static void main(String args[]){
	    MONTHS[] values = MONTHS.values(); 
	    for(MONTHS value : values){
		System.out.println(value); 
	    }
	}
	  
}

(III.) enum can be without any constant or methods as well.

e.g.

package com.masterjavatutorial;
public enum MONTHS {

   //Compiles fine.No error	 
 	  
}

(IV.) Even if there is no constants , if any method or constructor is defined , then semicolon is mandatory.

e.g.

package com.masterjavatutorial;
public enum MONTHS {
	 
        ;
	public static void main(String args[]){
		MONTHS[] values = MONTHS.values(); 
		for(MONTHS value : values){
			System.out.println(value); 
		}
	}
	  
}