title: Calling superclass method in superclass
body: <p>I am not able to find a good summary to describe my problem (suggestions welcome)</p>
  
  <p>I have following two classes:</p>
  
  <p><strong>Test1</strong></p>
  
  <pre><code>import java.lang.reflect.Method;
  
  abstract class Test1 {
  
      boolean condition = true;
  
      public void f() {
          System.out.println("Test1 : f");
      }
  
      public void g() {
          System.out.println("Test1 : g");
          f();
          if (condition) {
              f(); // call Test1.f() here. HOW?
  
              // Following didn't work
              try {
                  Method m = Test1.class.getDeclaredMethod("f");
                  m.invoke(this);
              } catch (Exception e) {
                  System.err.println(e);
              }
          }
      }
  }
  </code></pre>
  
  <p><strong>Test2</strong></p>
  
  <pre><code>class Test2 extends Test1 {
  
      public void f() {
          System.out.println("Test2 : f ");
      }
  
      public static void main(String[] args) {
          Test2 t2 = new Test2();
          t2.g();
      }
  
  }
  </code></pre>
  
  <p>The output is:</p>
  
  <pre><code>Test1 : g
  Test2 : f
  Test2 : f
  Test2 : f
  </code></pre>
  
  <p>The problem is that due to some special condition given by <code>condition</code> field in <code>Test1</code> I want to call <code>Test1</code>'s <code>f()</code> in <code>g()</code> even though I am calling using an object of <code>Test2</code>.</p>
  
  <p>I tried reflection but it doesn't work either. Any suggestions?</p>
  
  <p><strong>EDIT 1:</strong>
  I didn't mention it specifically, but if you see carefully Test1 is abstract. So I cannot create its object.</p>