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 kind of access does the 'protected' keyword provide?

  1. Package access

  2. Private access

  3. Public access

  4. Inheritance and package access

The correct answer is: Inheritance and package access

'Protected' is a keyword used in object-oriented programming languages, such as Java, to control the level of access to a class member. This keyword provides inheritance and package access, allowing subclasses and other classes in the same package to access the protected member. Option A, package access, provides access only within the same package, while option B, private access, only allows access within the same class. Option C, public access, allows access from any class.