June 2004
Intermediate to advanced
848 pages
21h 28m
English
There is another String feature with special built-in compiler support: concatenation, or joining of two Strings. Whenever a String is one operand of the “+” operator, the system does not do addition. Instead, the other operand (whatever it is, object or primitive) will be converted to a String, and the result is the two Strings appended together. If the operand is an object, it is converted to a String by calling its toString() method. The toString() method of Object is described on page 58; String has its own special version of this.
Concatenation is a piece of “magic” extra operator support for type String. The “+” operator used to be the only operator that could be applied to an object, until ...
Read now
Unlock full access