In the first example, the trim method produced a new String instance that is equal to " String " with the leading and trailing spaces removed. That new String instance is not the same instance as the one in the String constant pool. In the second example, "String".toString(), the toString method simply returns a reference to itself, and no new instance is created.
I would say that those examples fall into a category that Kathy Sierra refers to as Java Trivia. You don't have to worry about finding anything like that on the real exam. The exam is not intended to test your knowledge of when the String.trim method returns a reference to a new or existing instance of a String.
Dan Chisholm<br />SCJP 1.4<br /> <br /><a href="http://www.danchisholm.net/" target="_blank" rel="nofollow">Try my mock exam.</a>