Java Reference
In-Depth Information
public static String guillemete(String quote) {
return '«' + quote + '»';
}
This implicit conversion of primitive types and objects to strings happens
only when you're using
+
or
+=
in expressions involving strings. It does
not happen anywhere else. A method, for example, that takes a
String
parameter must be passed a
String
. You cannot pass it an object or
primitive type and have it converted implicitly.
When a
null
reference is converted to a
String
, the result is the string
"null"
, hence a
null
reference can be used freely within any string con-
catenation expression.