🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← All topics

Quiz: Java Enums: questions with answers

10 questions, each with the answer and a short explanation.

Take the timed quiz + get a certificate →
  1. Q1. What is the main advantage of an enum over int constants?
  2. Q2. What does this print? (code)
  3. Q3. Which statement about an enum's constructor is true?
  4. Q4. What happens with Day.valueOf("sun") when the constant is declared as SUN?
  5. Q5. What does this print? (code)
  6. Q6. Why is storing ordinal() in a database a bad idea?
  7. Q7. Can an enum extend another class?
  8. Q8. What does this print? (code)
  9. Q9. Why is == safe for comparing enum values?
  10. Q10. Which collection is designed for enum keys and keeps them in declaration order?