title: Override "private" method in java
body: <p>There something ambiguous about this idea and I need some clarifications.</p>
  
  <p>My problem is when using this code:</p>
  
  <pre><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");
      }
  }
  </code></pre>
  
  <p>The output is <code>hoho private</code>.</p>
  
  <p>Is this because the main function is in the same class as the method <code>don</code>, or because of overriding?</p>
  
  <p>I have read this idea in a book, and when I put the <code>main</code> function in another class I get a compiler error.</p>