Multiple choice technology programming languages

How restrictive is the default accessibility compared to public, protected, and private accessibility in Java?

  1. Less restrictive than public

  2. More restrictive than public, but less restrictive than protected.

  3. More restrictive than protected, but less restrictive than private.

  4. More restrictive than private.

  5. Less restrictive than protected from within a package, and more restrictive than protected from outside a package.

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Java accessibility ranges from least restrictive to most restrictive: public, protected, default (package-private), and private. Therefore, default access is more restrictive than protected (which allows package and subclass access) but less restrictive than private (class-only access).