title: Calling overloaded inherited methods using super class reference
body: <p>I do not understand this Java behavior. I have two classes:</p>
  
  <pre><code>class C1 {
      public void m1(double num) {
          System.out.println("Inside C1.m1(): " + num);
      }
  }
  
  class C2 extends C1 {
      public void m1(int num) {
          System.out.println("Inside C2.m1(): " + num);
      }
  }
  </code></pre>
  
  <p>And it is my main:</p>
  
  <pre><code>public class Main {
  
      public static void main(String[] args) {
          C1 c = new C2();
          c.m1(10);
      }
  }
  </code></pre>
  
  <p>And the result was:</p>
  
  <pre><code>Inside C1.m1(): 10.0
  </code></pre>
  
  <p>When I expected:</p>
  
  <pre><code>Inside C2.m1(): 10
  </code></pre>
  
  <p>Also when I try to complete the code syntax, I found this:</p>
  
  <p><img src="https://i.stack.imgur.com/np07x.png" alt="Enter image description here"></p>
  
  <p>Where is the other m1 of C2 class?</p>
  
  <p>I also check the bytecode of my Main.class and I saw this:</p>
  
  <pre><code>Compiled from "Main.java"
  public class com.company.Main {
    public com.company.Main();
      Code:
         0: aload_0
         1: invokespecial #1                  // Method java/lang/Object."&lt;init&gt;":()V
         4: return
  
    public static void main(java.lang.String[]);
      Code:
         0: new           #2                  // class com/company/C2
         3: dup
         4: invokespecial #3                  // Method com/company/C2."&lt;init&gt;":()V
         7: astore_1
         8: aload_1
         9: ldc2_w        #4                  // double 10.0d
        12: invokevirtual #6                  // Method com/company/C1.m1:(D)V
        15: return
  }
  </code></pre>
  
  <p>The bytecode tell me that it will invoke the C1.m1 (D)V (line 12).</p>
  
  <p>Why the method of C1? I am trying to understand this behavior.</p>