Java MCQ: What is an enum in Java?
a) A special class that represents a group of constants
b) A class that wraps a primitive type
c) A type of array
d) A collection type
Answer:
a) A special class that represents a group of constants
Explanation:
An enum
in Java is a special class that represents a group of constants. Enums are used to define a set of predefined values that a variable can hold, such as days of the week or states of a process.
Understanding enums is important for defining clear and consistent sets of values in Java applications.
Reference links:
https://www.rameshfadatare.com/learn-java-programming/
https://www.javaguides.net/p/java-tutorial-learn-java-programming.html