There something ambiguous about this idea and I need some clarifications.
My problem is when using this code:
public class B {
    private void don() {
        System.out.println("hoho private");
    }
    public static void main(String[] args) {
        B t = new A();
        t.don();
    }
}
class A extends B {
    public void don() {
        System.out.println("hoho public");
    }
}
The output is hoho private.
Is this because the main function is in the same class as the method don, or because of overriding?
I have read this idea in a book, and when I put the main function in another class I get a compiler error.
 
     
     
     
     
     
    