Monday , June 21 2021
Home / Java / JAVA #16 – Enum Type in Java

JAVA #16 – Enum Type in Java

Enum Types

An enum type is a special data type that enables for a variable to be a set of predefined constants. The variable must be equal to one of the values that have been predefined for it. Common examples include compass directions (values of NORTH, SOUTH, EAST, and WEST) and the days of the week.

package enumdatatype;

public class EnumDatatype {

    public enum Days {Mon,Tue,Wed,Thu,Fri,Sat,Sun};
    public static void main(String[] args) {
        System.out.println("The Off day is : "+ Days.Sun);
        System.out.println("The half off day is: "+Days.Fri);
    }
    
}

 

 

About Faheem

An adaptable and responsible Software Engineer, who enjoys working with computers and the opportunity to learn new skills and work with new technologies is particularly attractive to me.

Check Also

JAVA #32 – Java application using SQL server (Part: 01)

  In this part we made the GUI front end of a Application.

Leave a Reply

Your email address will not be published.