title: Why is long casted to double in Java?
body: <p><strong>SSCCE:</strong></p>
  
  <pre><code>public class Test {
  
      public static void main(String[] args) {
          Long a = new Long(1L);
          new A(a);
      }
  
      static class A {
          A(int i) {
              System.out.println("int");
          }
  
          A(double d) {
              System.out.println("double");
          }
      }
  }
  </code></pre>
  
  <p><strong>Output:</strong></p>
  
  <pre><code>double
  </code></pre>
  
  <p>There will be no compilation error printed, it works fine and calls <code>double</code>-parameter constructor. But <strong>why?</strong></p>