title: Why is the default type of Java integer literals int instead of long?
body: <p>I'm confused why Java integer literals default to <code>int</code> instead of <code>long</code>. This seems to cause unnecessary confusion.</p>
  
  <p>First, it requires the programmer to adopt a special syntax (append "L" to literals) when assigning a value to a <code>long</code> that exceeds the maximum <code>int</code> size (2147483647).</p>
  
  <pre><code>long x = 2147483647; // Compiles
  long y = 2147483648; // Does not compile
  long z = 2147483648L; // Compiles
  </code></pre>
  
  <p>Second, when using the <code>Long</code> wrapper class, the programmer must always use the <code>long</code> literal notation as explained in <a href="https://stackoverflow.com/questions/14425606/java-wrapper-classes-why-integer-literals-fail-for-long-but-work-for-smaller">this SO question</a>.</p>
  
  <pre><code>Long x = 250; // Does not compile
  Long y = 250L; // Compiles
  </code></pre>
  
  <p>Third, considering that implicit conversion from <code>int</code> literals to the "narrower" data types (<code>short</code> and <code>byte</code>) works just fine in all situations (that I know of), it seems that simply making all integer literals type <code>long</code> would have been the obvious solution... right? Wouldn't this completely remove the need for this odd system of appending "L" to integer literals in special cases?</p>