Differentiate between private and protected visibility modifiers.
Views 19
Answer:
-
Private Modifier:
- The most restrictive access level.
- Members are accessible only within the same class.
-
Protected Modifier:
- Allows access to members within the same package or through inheritance in subclasses, even if they are in different packages.
Related Articles:
This section is dedicated exclusively to Questions & Answers. For an in-depth exploration of Java Programming Language, click the links and dive deeper into this subject.
Join Our telegram group to ask Questions
Click below button to join our groups.