the trim() method will return a reference to a new object. In this case, it will refer to a newly created string with a value of "String".
in other words, you will end up with 3 String objects created. two in the string pool (with values of " String " and "String"), and a third created by the trim() call. since the == operator checks to see if we refer to the same object, we get a false.
if you had instead done
after being chastized for writing such an ugly
test condition, you'd get a true (assuming i didn't make any typos).
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors