Review Questions

4.20 Which statements are true about the use of modifiers?

Select the two correct answers.

  1. If no accessibility modifier (public, protected, and private) is specified for a member declaration, the member is only accessible for classes in the package of its class and subclasses of its class anywhere.

  2. You cannot specify accessibility of local variables. They are only accessible within the block in which they are declared.

  3. Subclasses of a class must reside in the same package as the class they extend.

  4. Local variables can be declared static.

  5. Objects themselves do not have any accessibility modifiers, only the object references do.

4.21

Get Programmer's Guide to Java™ Certification, A: A Comprehensive Primer, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.