You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The enum type has a values() method, which returns an array of all enum constants. This method is useful when you want to loop through the constants of an enum.
enumLevel {
LOW,
MEDIUM,
HIGH
}
publicclassMyClass {
publicstaticvoidmain(String[] args) {
for (LevelmyVar : Level.values()) {
System.out.println(myVar);
}
}
}