Multiple choice technology

Which keyword can protect a class in a package from accessibility by the classes outside the package

  1. private

  2. final

  3. protected

  4. don't use any keyword at all (make it default)

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

In Java, if you do not specify an access modifier like public, private, or protected, the class or member gets default (package-private) accessibility. This restricts visibility strictly to classes within the same package.