Access modifiers in Java controls access scope of class, constructor, variable, method, or data member. Various types of access modifiers are as follows:
1. Default access modifier is without any access specifier data members, class and methods, and are accessible within the same package.
2. Private access modifiers are marked with the keyword private, and are accessible only within class, and not even accessible by class from the same package.
3. Protected access modifiers can be accessible within the same package or subclasses from different packages.
4. Public access modifiers are accessible from everywhere.
Posted Date:- 2021-09-30 06:39:33