class String example
When you concatenate a null to a string, the result is null. By passing a value that may be null through the String class constructor, you can safely concatenate two values without using cumbersome conditional constructs. For example, suppose you are combining, first name, middle initial, and last name. The middle initial field may be null. You can safely combine the three like this:
fullName = firstName + " " + new String(middleInitial + " ") + lastName
If the middle initial is null, adding a space to it results in null, and the String object will be an empty string. If the middle initial is not null, adding a space will result in a space between the middle initial and the last name.