question
public class A {
public void foo(){System.out.println("A");}
//change here
public void goo(){foo();}
}
public class B extends A {
public void foo(){System.out.println("B");}
}
public class Test {
public static void main(String[] args) {
B b = new B();
b.goo();
}
}
the output is :
B
but , if we change in class A the word public to private (where it says "change here) to
private void foo(){System.out.println("A");}
then the output is :
A
Why is that ??

