title: What does '+i' mean in Java?
body: <p>I ran across this while reviewing a colleague's code. She'd left it in by accident (it used to be a String concatenation), and I assumed that it wouldn't compile. Turns out I was wrong, so I tried seeing what that operator did:</p>
  
  <pre><code>public static void main(String[] args) {
      int i = -1;
      System.out.println(String.format("%s", +i));
      System.out.println(String.format("%s", +i));
  }
  </code></pre>
  
  <p>As far as I can tell, it does nothing, but I'm curious if there is a reason it's allowed to compile. Is there some hidden functionality to this operator? It's similar to <code>++i</code>, but you'd think the compiler would barf on <code>+i</code>.</p>