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 is true about methods in a Java interface?

  1. They can have method bodies if marked static

  2. They are automatically public

  3. They must be abstract

  4. They can be private

The correct answer is: They are automatically public

Interface methods are automatically public, meaning they can be used and accessed by any other class. Option A is incorrect because static methods do not require an object to be called and interfaces cannot have objects. Option C is incorrect because all interface methods are abstract, meaning they do not have a method body. Option D is incorrect because all interface methods are public and therefore cannot be private.