Why i cant call protectedMethod() even the object of class Parent call its method?
package packageA;
public class Parent{
  protected void protectedMethod(){
     System.out.println("Hello Parent");
  }
}
and in another Package :
package packageB;
import packageA.Parent;
Public Class Child extends Parent{
    public static void main(String[] args) {
        Parent parent = new Parent();
        parent.protectedMethod(); //illegal
        Child child = new Child();
        child.protectedMethod(); // legal       
    }
}
 
     
    