Mastering Java: The Ultimate Quiz for 'Thinking in Java'

Disable ads (and more) with a membership for a one time $2.99 payment

Want to excel in Java? Test your knowledge with our ultimate quiz based on 'Thinking in Java'. Engage with multiple-choice questions and in-depth explanations. Boost your understanding and prepare for your exam with confidence.

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 access level does a class member have if no access specifier is provided?

  1. Private

  2. Protected

  3. Public

  4. Package access

The correct answer is: Package access

Without an access specifier, a class member would have package access. This means that the member can be accessed by classes within the same package, but not by classes outside of that package. Options A, B, and C refer to specific access specifiers in Java and are therefore incorrect. Option C, public, would give all classes access to the member, while options A and B would limit the access to the class within which the member is declared or inherited classes. Package access is the default access level in Java if no access specifier is provided.