public class A {
private void getHello(){
System.out.println("Prints A");
}
}
class B extends A {
public void getHello(){
System.out.println("Prints B");
}
}
class Test{
public static void main(String[] args) {
A a = new B();
}
}
I am creating private method in class A
creating public method with same name in class B by extending class A
Even after creating object for B with A reference
why I am not able to call getHello()?