title: Overrided method visibility in Java
body: <p>Assume that we have a package "p1":</p>
  
  <pre><code>package p1;
  
  public class A {
      protected void method() { }
  }
  </code></pre>
  
  <p>... and we also have a package "p2":</p>
  
  <pre><code>package p2;
  
  import p1.A;
  
  public class B extends A { }
  
  class Tester {
      static void run() {
          new B().method(); //compile-time error
      }
  }
  </code></pre>
  
  <p>Now if we try to compile a whole example we'll stuck at the marked line with compile-time error: compiler just doesn't see a target method in B. Why so?</p>