Java Reference
In-Depth Information
And here is its output:
boohoo!
The
+
operator is interpreted as the string concatenation operator
whenever at least one of its operands is a
String
. If only one of the op-
erands is a
String
then the other is implicitly converted to a
String
as
discussed in "
String Conversions
" on page
220
.
9.2.9.
new
The
new
operator is a unary prefix operatorit has one operand that fol-
lows the operator. Technically, the use of
new
is known as an
instance
creation expression
because it creates an instance of a class or array.
The value of the expression is a reference to the object created. The use
of
new
and the associated issue of constructors was discussed in detail
on page
50
.