title: Java Short addition questions
body: <p>This may have already been answered in another post, but I just am not getting why something won't compile in my test Java app (1.7.0_01).</p>
  
  <p>This compiles:</p>
  
  <pre><code>Short a = (short)17;
  a = (short)2 + 1;
  </code></pre>
  
  <p>I know that "a + a" will result in an integer.  This compiles fine:</p>
  
  <pre><code>Short a = (short)17;
  int shortTest = a + a;
  </code></pre>
  
  <p>So why doesn't this compile?</p>
  
  <pre><code>Short a = (short)17;
  a = (short)a + a;
  </code></pre>
  
  <p>Also, am I right to assume you can't use +=, -=, etc... on Shorts because of the conversion to integer?  If it's possible to do those operations, can someone provide an example?</p>
  
  <p><b>Edit 1</b><br>
  There's been some votes to close this post as it's been suggested that it's a duplicate of <a href="https://stackoverflow.com/questions/477750/primitive-type-short-casting-in-java">Primitive type 'short' - casting in Java</a>.  However, my example revolves around the Wrapper "Short" object.  There are important and more complicated rules around casting Wrapper objects and that's what I think needs to be focussed on.</p>
  
  <p>Also, as my original post indicates, I'm looking for the <b>"why"</b> behind the 3rd code block.  I'm also interested to know if it's possible to use "+=", "-=", etc... on the Short Wrapper.</p>