Mastering Java: The Ultimate Quiz for 'Thinking in Java'

Disable ads (and more) with a membership for a one time $2.99 payment

Dive into the depths of Java with our quiz based on "Thinking in Java, Fourth Edition" by Bruce Eckel. Test your knowledge, solidify concepts, and prepare for certification with challenging questions and insightful feedback.

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


What alternative do enums have since they cannot be inherited from?

  1. Extending classes

  2. Implementing interfaces

  3. Static importing

  4. None of the above

The correct answer is: Implementing interfaces

Enums in Java cannot be inherited from, so options A and C, which describe a process of inheriting attributes from other classes, are incorrect. Option D is also incorrect because there is another alternative for enums besides inheritance. Rather, enums have the alternative of implementing interfaces, which allows them to define their own methods and attributes while still preventing them from being inherited. This is why option B is the correct answer.