title: Java ternary operator and NullPointerException
body: <p>hi，I encountered a problem in works，the question like this:<br></p>
  
  <pre><code>Integer test1=null;
  Integer test2=null;
  </code></pre>
  
  <p>i call them like this:<br></p>
  
  <pre><code>test2=(test1==null?test1:(test1+1));
  test2=(test1==null?test1:-1);
  </code></pre>
  
  <p>then the java throw a NullPointerException,so iwrite another code like this:</p>
  
  <pre><code>test2=(test1==null?test1:test1); 
  </code></pre>
  
  <p>this code is ok.</p>
  
  <p>but,why?</p>