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.


How is 'friendly access' achieved?

  1. Using the friend keyword

  2. Using no access specifier

  3. Making members public

  4. Making members protected

The correct answer is: Using no access specifier

Friendly access is achieved by using the 'friend' keyword and providing that keyword in front of the specific function or class that you want to give access to. Option A is incorrect because using the keyword itself does not automatically grant access - it must be followed by a specific function or class. Option C is incorrect because making members public makes them accessible to anyone, not just friends. Option D is incorrect because making members protected allows access only to derived classes, not friends.