Which access modifier allows access from the same package and subclasses in different packages?

Java Professional Easy

Java Professional — Easy

Which access modifier allows access from the same package and subclasses in different packages?

Key points

  • Protected allows access from same package and subclasses in different packages
  • Private restricts access to the class itself
  • Public allows access from anywhere
  • Default (package-private) only allows access within the same package

Ready to go further?

Related questions