Я пытаюсь понять, почему защищенная переменная в суперклассе недоступна в дочернем классе?
package pack1;
public class Parent {
protected int r;
public int s;
}
package pack2;
import pack1.Parent;
public class Child extends Parent {
public static void main(String[] args) {
Parent obj = new Child();
obj.r = 2; //r is not accessible here. It becomes accessible when I make it static.
obj.s = 3; //s is accessible.
}
}
public
,protected
иprivate
- person V-rund Puro-hit   schedule 08.09.2018