Java Enums

Enums were introduced as part of the Java package in java 5.0. Enums limit a variable to have one of just a couple of predefined qualities. The qualities in this identified list are called enums. With the utilization of enums it is conceivable to diminish the quantity of bugs in your code. Case in point, in the event that we consider an application for a cafe, it would be conceivable to limit the mug size to extra large, large, medium and small. This would verify that it would not permit anybody to request any size other than the sizes mentioned in the menu or application listing.

Please note that enums can be pronounced as their own or inside a class. However, routines, variables, constructors can be created inside the body of enums as well.