I have two classes in two different packages:
package package1;
public class Class1 {
public void tryMePublic() {
}
protected void tryMeProtect
the protected modifier is 1.Package Private 2.can be seen by subclasses from other packages. now the key difference between :
MyClass1 c = new MyClass1();
c.tryMeProtected();
and
tryMyProtected();
is that the MyClass1 reference is used rather than inheritance. MyClass1 is in a different package and this code is not inheriting from MyClass1.