3.6. The Binary String Concatenation Operator +
The binary operator + is overloaded in the sense that the operation performed is determined by the type of the operands. When one of the operands is a String object, the other operand is implicitly converted to its string representation and string concatenation is performed. Non-String operands are converted as follows:
For a operand of a primitive data type, its value is converted to a String object with the string representation of the value.
Values like true, false, and null are represented by string representations of these literals. A reference variable with the value null also has the string representation "null" in this context.
For all reference value operands, a string representation is constructed ...
Get Programmer's Guide to Java™ Certification, A: A Comprehensive Primer, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.