Enum Example in Java

Enum

This example shows how to create and use an Enum in Java. Sample code to create user defined constants with enums type special class.

— In Java (from 1.5) an Enum is a special data type that enables for a variable to be a set of predefined constants.
— Keyword ‘enum’ is used to define an Enum.
— Because they are constants, the names of an enum type’s fields are in uppercase letters.

Share This Post On: