String ring = "One ring to rule them all, "
String find = "One ring to find them."

ring = ring + find;

A good answer might be:

No. The String objects don't change. The reference variable ring is changed in the third statement to refer to a different String than originally. (Its original String becomes garbage, which is collected by the garbage collector. When it has no references, it is outside the view of the program and is recycled.)

trim()

Here is a line of the documentation for the String class.

public String trim();

The trim() method of a String object creates a new String that is the same as the original except that any leading or trailing space is trimmed off (removed).

QUESTION 13:

Examine the following code:

String userData = "     745   ";
String fixed;

fixed = userData.trim();

Has the trim() method been used correctly? How many objects have been created?