== operator does not compare references for String
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/3885753/string-comparison-and-string-interning-in-java">String comparison and String interning in Java</a>  </p>
</blockquote>



<p>I understand how String equals() method works but was surprised by some results I had with the String == operator.</p>

<p>I would have expected == to compare references as it does for other objects.</p>

<p>However distinct String objects (with the same content) == returns true and furthermore even for a Static String object (with the same content) which is obviously not the same memory address.</p>

<p>I guess == has been defined the same as equals to prevent its misuse</p>
