title: Problem with equals Strings in Java
body: <p>I have two "equal" Strings. When I print both Strings they look exactly the same in the screen. But when I compare the Strings the result is "false" and using .length in both Strings the result is 174 for the first String and 171 for the second.  I have deleted all whitespaces and everything to set the Strings in one line.</p>
  
  <pre><code>String 1:
  &lt;docxmlns="http://example.com/default"xmlns:x="http://example.com/x"&gt;&lt;aa1="1"a2="2"&gt;123&lt;/a&gt;&lt;bxmlns:y="http://example.com/y"a3="&amp;quot;3&amp;quot;"y:a1="1"y:a2="2"&gt;cdf&lt;/b&gt;&lt;/doc&gt;
  
  String 2:
  &lt;docxmlns="http://example.com/default"xmlns:x="http://example.com/x"&gt;&lt;aa1="1"a2="2"&gt;123&lt;/a&gt;&lt;bxmlns:y="http://example.com/y"a3="&amp;quot;3&amp;quot;"y:a1="1"y:a2="2"&gt;cdf&lt;/b&gt;&lt;/doc&gt;
  
  String 1 length: 174
  String 2 length: 171
  </code></pre>
  
  <p>I copied both Strings from Netbeans console, as you can see they are equals but they have different lengths.</p>
  
  <p>Thanks.</p>