more complete explanation:
"String" will refer to a String constant on the String constant pool.
" String " refers to another String constant on the String constant pool.
" String ".trim() refers to a String instance on the heap.
The left and right operand of your comparison then are two different String instances. The == operator compares whether two object instances refer to the same instance, not whether they have a content identity (iow, whether two object instances are identical on a field comparison).
the equals() member method (as indicated in the previous answer) does that.
== will work for low Number instances referring to Integers and Longs because it has been specifically overridden for that purpose, but that's an exception to a very strict rule.