Access Modifiers in Java

Java 8Object Oriented ProgrammingProgramming

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.



raja
Published on 06-Feb-2018 17:31:43
Advertisements