← Back to Miscellaneous
Question 166
Enum with Field and Constructor
Enum with Field and Constructor
Use an enum with a constructor, field, and getter method to store and retrieve a numeric priority level. The starter code provides the full enum: Priority has values LOW(1), MEDIUM(2), HIGH(3), each storing an int level. The constructor sets the field;getLevel()retrieves it. Set p =Priority.HIGHand printp.getLevel().
Expected Output:
Priority level: 3= newline. The output ends with a newline — print one after the last line.
Hints2 available
Sign in to use hintsTopics:
Miscellaneous
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (sysout, psvm, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.