Java Interview Questions

BY Author

Java – Enumerations

In Java, enumeration is a group of constants. It is far different from enumof old languages like C & C++.It can contain variables, methods & constructors like normal classes.An enumkeyword is used to create enumeration.

Example of enumeration

enumFruits
{
Apple, Banana, Pineapple, Papaya, Strawberry}

Enumeration variable

Declaring enumeration variable is same as declaring variable in a class.