title: String concatenation does not work properly in Java when concatenating 2 results of ternary operators
body: <p>Dear Java guru 's!</p>
  
  <p>Can you, please, explain me, why String concatenation does not work properly in Java when concatenating 2 results of ternary operators? </p>
  
  <p>Example:</p>
  
  <pre><code>String str = null;
  String x = str != null ? "A" : "B" + str == null ? "C" : "D";
  System.out.println(x);
  </code></pre>
  
  <p>Output is "D", but I expected "BC".</p>
  
  <p>I am suspecting that it works like so because of operators priorities, but I am not sure, about how we exactly we get "D" for case above. What calculation algorithm takes place for this case?</p>