Computer Science, asked by parmjeetkaurgng8550, 1 year ago

Why Protected access modifier used in Java?

Answers

Answered by himailinator
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