title: Using, if applicable, the subclass' method
body: <p>I have the following code:</p>
  
  <pre><code>public class A {
      private boolean val(){
          return true;
      }
  
      protected boolean test(){
          return val();
      }
  }
  
  public class B extends A {
      private boolean val(){
          return false;
      }
  }
  
  public class C {
      public static void main(String[] args){
          B b = new B();
          System.out.println(b.test());
      }
  }
  </code></pre>
  
  <p>It returns true because the test() method in A calls A's val(). After some research, I understood that this is expected in Java. However, I would like test() to print false when called from B, and true when called from A.
  Is it possible to do that?</p>