Access modifiers determine which parts of a program can access a class, field, or method. They are the foundation of encapsulation — hiding implementation details.
Four Access Levels
Access modifiers determine which parts of a program can access a class, field, or method. They are the foundation of encapsulation — hiding implementation details.