I'm reading though some notes. And I'm not understanding the following two statements.Polymorphism means that it is always the class of the actual object at run time that determines which method will be called at run time.class A{    public void m1(){    System.out.println( A);    }} class B extends A{    public void m1(){    System.out.println( B);    }    public void m2(){    System.out.println( m2);    }} B b = new B();A a = new B();// will print Bb.m1();// will also print B because a refers to an object of class B.a.m1();While accessing a method or variable, the compiler will only allow you to access a method or variable that is visible through the class of the reference.interface Flyer{    String getName();} class Bird implements Flyer{...    public String getName(){        return name;    }    public String getNativeOf(){    return nativeOf;    }}Flyer f = new Bird();f.getName(); //validf.getNativeOf(); //will not compile because the class of reference f is Flyer and not Bird.((Bird) f).getNativeOf(); //valid because class of the object referred to by f is Bird.So is it by actual object or reference?
Understanding polymorphism and interface in Java
java;interfaces;polymorphism