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 must classes do to conform to an interface?

  1. Declare all interface fields

  2. Implement all abstract methods

  3. Extend another concrete class

  4. Provide default implementations

The correct answer is: Implement all abstract methods

Classes that implement an interface must provide implementations for all of the abstract methods declared in the interface. Option A is incorrect because interfaces do not have fields, they only have method signatures. Option C is incorrect because interfaces cannot be extended, they are implemented. Option D is incorrect because interfaces do not have default implementations, they only provide method signatures. Therefore, the correct answer is B, since implementing all the abstract methods in an interface is a key requirement for classes to conform to an interface.