Accessibility scope of Java access modifiers -
this question has answer here:
java has private, protected, , public access modifiers. can explain accessibility scope of these modifiers.
how can access protected member within different package?
for better understanding need see this
access modifiers same class same package subclass other packages public y y y y protected y y y n no access modifier y y n n private y n n n
here important difference between deafult
, protected
.
default: never accessible outside package
protected: accessible outside package , if , if , class sub class
please see this further details.
edit: question's answer same you can access protected member make class sub class of class , in protected member defined
Comments
Post a Comment