Scope of Default Access Modifier in Java



Default access modifier means we do not explicitly declare an access modifier for a class, field, method, etc.

The scope of the default access modifier lies within the package. When a class or its members associated with default access modifier then.

Example

Variables and methods can be declared without any modifiers, as in the following examples:

String version = "1.5.1";
boolean processOrder() {
   return true;
}
Updated on: 2019-07-30T22:30:20+05:30

1K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements