Java is an  Object Oriented Programming language. In Java, an enumeration is a particular class that represents a group of constants. All possible values in the Enums are used at Compile time. In Java, we represent the Enum class with the help of enum data type. Enum in Java more powerful than enum in C/C++. We can add methods, variables, and  constructor to it.

Key Points in Enum

  1. enum improve type safety.
  2. enum can be easily used in the switch.
  3. enum can have fields, constructors, and methods.
  4. enum can implement many  interfaces but cannot  extend any class because it internally extends the Enum class.
  5. enum can be traversed.

#java #java enum #c/c++ #programming

Java Enum Tutorial With Example | Enumeration Class in Java
1.55 GEEK