Enum (Enumeration) in Java is a special data type used to define a fixed set of constants. It provides type safety and makes code more readable when a variable can have only a predefined set of values.
Instead of using String values such as "PENDING", "APPROVED", and "REJECTED", an enum can be used to define these statuses in a safer and more maintainable way.
enum Status {
PENDING,
APPROVED,
REJECTED
}
public class Demo {
public static void main(String[] args) {
Status status = Status.APPROVED;
System.out.println(status);
}
}A concise interview answer is
Enum is a special Java data type used to define a fixed set of constants. It provides type safety, improves code readability, and is commonly used when a variable can have only a predefined set of values such as statuses, roles, or days of the week.
Last updated: 11 November 2026
Previous question: What is the use of the 'this' keyword in Java?
Next question: What is multithreading in Java?