Java - Packages and Access Control
Consider the following code in two packages:
What is the output when running
package pkg1;
public class Parent {
protected int value = 10;
}
package pkg2;
import pkg1.Parent;
public class Child extends Parent {
public int getValue() {
return value;
}
}
public class Test {
public static void main(String[] args) {
Child c = new Child();
System.out.println(c.getValue());
}
}What is the output when running
Test.main?