title: Why does byte not get type promoted to long (Type promotion during method overloading)
body: <p>In the first piece of code byte gets type promoted to integer type</p>
  <pre><code>public class Main
  {
      Main(int a,byte b){
          System.out.println(&quot;int 1&quot;);
      }
      
      Main(int a,float b){
          System.out.println(&quot;float 1&quot;);
      }
      
      Main(float a,int b){
          System.out.println(&quot;float 2&quot;);
      }
      
      public static void main (String[] args) {
          byte a = 10;
          byte b = 20;
          Main obj = new Main(a,b);
      }
  }
  </code></pre>
  <p><em><strong>Output</strong></em><br />
  int 1</p>
  <p>In the second code the compiler throws an error</p>
  <pre><code>public class Main
  {
      Main(long a,byte b){
          System.out.println(&quot;int 1&quot;);
      }
      
      Main(int a,float b){
          System.out.println(&quot;float 1&quot;);
      }
      
      Main(float a,int b){
          System.out.println(&quot;float 2&quot;);
      }
      
      public static void main (String[] args) {
          byte a = 10;
          byte b = 20;
          Main obj = new Main(a,b);
      }
  }
  </code></pre>
  <p><em><strong>Error</strong></em></p>
  <pre><code>Main.java:25: error: reference to Main is ambiguous
          Main obj = new Main(a,b);
                     ^
    both constructor Main(int,float) in Main and constructor Main(float,int) in Main match
  1 error
  
  
  ** Process exited - Return Code: 1 **
  </code></pre>
  <p>Why in the second code the constructor with long a and byte b as parameters is not being called?</p>