Question #630

How to define the class field available only to its sub-classes in Java?

Expert's answer

You have to specify the keyword «protected» while declaring the variable. After that the variable will be "visible" only to sub-classes.
LATEST TUTORIALS
APPROVED BY CLIENTS