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 are the fields in an interface implicitly?

  1. Public and final

  2. Private

  3. Protected

  4. Static only

The correct answer is: Public and final

When you implement an interface, all methods are implicitly public if they are not declared as anything else. This means that they can be accessed by any other class in the program. Additionally, all variables defined in an interface are automatically public, final, and static, meaning that they cannot be changed and can be accessed globally. Option B and C are both incorrect because private and protected keywords are not allowed in an interface. Option D is incorrect because the variables in an interface are not implicitly static, they are explicitly static.