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

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

Prepare for your Java exam with our ultimate quiz based on 'Thinking in Java'. Engage with expertly crafted questions that enhance your learning process. Perfect for Java enthusiasts looking to solidify their knowledge!

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.