Must-do problems: Enums
120 min · Beginner
Need help? Ask a tutor on WhatsApp (opens in a new tab)Every problem here is built around one or two enums: decide which values form a fixed list, what data and behaviour each constant carries, and how input text becomes a constant. Write the enum first, then main, and run every test before opening a hint.
What you will learn
- Model fixed lists of values as enums with fields, methods and constant-specific bodies
- Turn input text into constants safely with valueOf() and fromCode() lookups
- Use exhaustive switch expressions and enum state machines
- Combine enums with interfaces, arrays and exceptions in one program
Sign in to continue this lesson
Create an account to read every lesson, practise with the exercises and keep track of your progress.