package packageOne;
public class Base
{
protected void display(){
system.out.println("in Base");
}
}
package packageTwo;
public class Derived extends packageOne.Base{
public void show(){
new Base().display();//this is not working throws compilation error that display() from the type Base is not visible
new Derived().display();//is working
display();//is working
}
}
Два пакета находятся в двух разных файлах. Но почему это поведение?