title: Two variables from if else statement to ternary operator
body: <blockquote>
    <p>In JAVA, what is the best way to convert the below code to use ternary operator:</p>
  </blockquote>
  
  <pre><code>if (input &gt; 0) 
  {
      result1 = input;
      result2 = input;
  } 
  else 
  {
      result1 = -1;
      result2 = -1;
  }
  </code></pre>