title: Java: Calling a super method which calls an overridden method
body: <pre><code>public class SuperClass
  {
      public void method1()
      {
          System.out.println("superclass method1");
          this.method2();
      }
  
      public void method2()
      {
          System.out.println("superclass method2");
      }
  
  }
  
  public class SubClass extends SuperClass
  {
      @Override
      public void method1()
      {
          System.out.println("subclass method1");
          super.method1();
      }
  
      @Override
      public void method2()
      {
          System.out.println("subclass method2");
      }
  }
  
  
  
  public class Demo 
  {
      public static void main(String[] args) 
      {
          SubClass mSubClass = new SubClass();
          mSubClass.method1();
      }
  }
  </code></pre>
  
  <p>my expected output:</p>
  
  <blockquote>
    <p>subclass method1<br>
    superclass method1<br>
    superclass method2  </p>
  </blockquote>
  
  <p>actual output:</p>
  
  <blockquote>
    <p>subclass method1<br>
    superclass method1<br>
    subclass method2</p>
  </blockquote>
  
  <p>I know technically I have overriden a public method, but I figured that because I was calling the super, any calls within the super would stay in the super, this isn't happening. Any ideas as to how I can make it happen?</p>