+ 3
Enums are user defined classes which stop the programmer from inserting wrong values. An enum contains a set of constants which can be accessed in other class. The programmer directly uses this value instead of typing the the values all the time. Example:Suppose you want to make an enum for directions. You can declare an enum as directions where you will mention values North,South,East,West. While using it in program you can directly write Directions.North or any other direction you want.
17th Dec 2017, 5:45 PM
Varshil Shah
Varshil Shah - avatar