What are access modifiers?
Access modifiers are a tool with which you can customize access to classes, methods, and variables. There are the following modifiers, ordered in ascending order of access:
private– used for methods, fields, and constructors. The access level is only the class within which it is declared.
package-private(default)– can be used for classes. Access only in a specific package (package) in which the class, method, variable, constructor is declared.
protected– same access as
package-private+ for those classes that inherit from class with modifier
public– also used for classes. Full access throughout the app.