The meaning of the access modifier in Java, public, private, PROTECTE, default, is explained:
The most restrictive modifier in the Public:java language, commonly referred to as "public". Classes, properties, and methods that are modified by it are not
Can be accessed only across classes, and across packages (package).
The narrowest modifier for access restrictions in the Private:java language is generally referred to as "private." The classes, attributes, and properties that are modified to
and methods can only be accessed by objects of that class, their subclasses are inaccessible, and cross-package access is not allowed.
Protect: An access modifier between public and private, commonly referred to as a "protected form." The class that is modified by it,
Properties and methods can only be accessed by methods and subclasses of the class itself, even if the subclasses are accessible in different packages.
Default: That is, without any access modifiers, often referred to as the "Default access mode." In this mode, only the same package is allowed to be visited
Ask.
Access modifiers in Java public, private, PROTECTE, default