Access Modifiers in Java


Java provides a number of access modifiers to set access levels for classes, variables, methods, and constructors. The four access levels are -

  • default - Visible to the package. No modifiers are needed.
  • private - Visible to the class only.
  • public - Visible to the world.
  • protected - Visible to the package and all sub classes.



Updated on: 24-Feb-2020

166 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements