Definition
Java Access Specifiers regulate access to classes, fields and methods in Java.These Specifiers determine the scope of a method or variable or loop.Default Access Specifier Example Program
class Main {
int num=100000;
}
class DefaultAccessSpecifier {
public static void main(String[] args) {
Main obj = new Main();
int number = obj.num; // works
System.out.println("The value of the variable with default access specifier in this program is: "+number);
}
}
Sample Output
Output is:
The value of the variable with default access specifier in this program is: 100000