🎙 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 does this print? (code)
  2. Q2. What is the main advantage of an enum over int constants for a method parameter?
  3. Q3. What does Status.valueOf("shipped") do if the constant is named SHIPPED?
  4. Q4. What does this print? (code)
  5. Q5. Which statement about an enum constructor is true?
  6. Q6. Why should you store name() and not ordinal() in a database?
  7. Q7. Can an enum extend another class?
  8. Q8. What does this print? (code)
  9. Q9. How do you compare two enum values a and b for equality?
  10. Q10. Which is a simple, thread-safe way to write a Singleton in Java?