title: Why does addition of long variables cause concatenation?
body: <p>What does Java do with long variables while performing addition?</p>
  
  <p>Wrong version 1:</p>
  
  <pre><code>Vector speeds = ... //whatever, speeds.size() returns 2
  long estimated = 1l;
  long time = speeds.size() + estimated; // time = 21; string concatenation??
  </code></pre>
  
  <p>Wrong version 2:</p>
  
  <pre><code>Vector speeds = ... //whatever, speeds.size() returns 2
  long estimated = 1l;
  long time = estimated + speeds.size(); // time = 12; string concatenation??
  </code></pre>
  
  <p>Correct version:</p>
  
  <pre><code>Vector speeds = ... //whatever, speeds.size() returns 2
  long estimated = 1l;
  long size = speeds.size();
  long time = size + estimated; // time = 3; correct
  </code></pre>
  
  <p>I don't get it, why Java concatenate them.</p>
  
  <p>Can anybody help me, why two primitive variables are concatenated?</p>
  
  <p>Greetings, guerda</p>