Why Protected access modifier used in Java?
Answers
Answered by
0
The protected modifier only allows for access to the variable and/or method by subclasses and other classes in a package. Typically, protected is used to prevent others from access the data except in controlled ways. Kind of like an "invited guest" status versus anyone on the street just wandering by.
Similar questions
Physics,
6 months ago
Computer Science,
6 months ago
Computer Science,
1 year ago
Computer Science,
1 year ago
Math,
1 year ago
Math,
1 year ago