Access means to approach, and Access Modifiers are those keywords that define the namespace of variables, methods,  constructors, classes, etc. Access Modifier is the keywords in  object-oriented languages, which makes to understand who can approach that particular Data member, method, Class, etc.

Access Modifiers in Java

Access modifiers in Java language help to restrict a scope of the class, constructor, variable, method, or the data member. There are four types of access modifiers available in Java language.

  1. Default – No keyword required: Visible to the package
  2. Private: Visible to the class only
  3. Protected: Visible to the package and all the subclasses
  4. Public: Visible to the world

Access Modifiers in Java

#java #java access modifiers

Access Modifiers in Java Example | Java Access Modifiers
1.70 GEEK