Types of access modifiers in Java?

Java 8Object Oriented ProgrammingProgramming

Java provides four types of access modifiers to set access levels for classes, variables, methods, and constructors. Following are the access levels -

  • 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 subclasses.

raja
Published on 05-Feb-2018 12:06:37
Advertisements