enum Level { LOW("A"), MEDIUM("B"), HIGH("C"); public final String value; Level(String val){ value=val; } public String getValue() { return value; } } public class Main { public static void main(String[] args) { String myVar = Level.HIGH.getValue(); System.out.println(myVar); } }
Output |
No comments:
Post a Comment