title: Why do I get an ambiguity error in this code?
body: <p>Let's say we have these 3 classes:</p>
  <pre><code>class A { }
  class B extends A { }
  
  public class App {
      static void f(int i, A a) { }
      static void f(float j, B b) { }
     
      static public void main() {
          int i = 0;
          B b = new B();
          App.f(i, b);
      }
  }
  </code></pre>
  <p>This produces the error:</p>
  <pre class="lang-none prettyprint-override"><code>App.java:11: error: reference to f is ambiguous
          App.f(i, b);
             ^
    both method f(int,A) in App and method f(float,B) in App match
  1 error
  </code></pre>
  <p>Why does it not choose the type <code>f(int, A)</code> since <code>i</code> is an integer?</p>