What are the mechanics behind Java automatically interpreting string literals as String objects, since there are no overloaded operators and there is no default support for
Java actually does have a few overloaded operators. For example, +
can be applied to String objects as well as to int, float, and other numerical types. In each case, the return type is defined by the type of the expression on each side of the +
. However, all overloaded operators are predefined in the language; programmers have no mechanism in the language to define any others. See the language specification for details.