Difference between protected and default access The default access specifier is one which is not specified with a key word. If no access specifier (any one of private, protected, public) is mentioned it is known as the default access specifier. The methods, variables of class without access specifier can be accessed by classes, methods within the package in which they were declared.
The protected access specifier also has the same scope that of default access specifier and can be accessed in all subclasses of the protected class across packages i.e., packages other than the package in which the protected member is declared / defined.
|