Hi Ify,
In the second println
<pre>
System.out.println( " String ".trim() == ("String") );
</pre>
The <code>trim()</code> operation removes the spaces and returns a new string object with the chars "String".
In the last println
<pre>
System.out.println( "String".trim() == ("String") );
</pre>
there is nothing for <code>trim()</code> to do! There are no empty spaces to remove so
the original String object is returned.
If the original string object satisfies the contract of the method being called, a reference to the original string object is returned,
a new object is not created.
This is one of the ways
Java optimizes string handling.
Hope that helps.
------------------
Jane Griscti
Sun Certified Programmer for the Java� 2 Platform