The enum Type in Java


Enums are used to declare a set of named constants, making your code more readable.

Source Code

enum Level {
    LOW,
    MEDIUM,
    HIGH
}
public class Test {
    public static void main(String[] args) {
        Level myVar = Level.MEDIUM;
        System.out.println(myVar);
    }
}
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments