I suspect operator overloading in Java. I know that the Java operator does not support overloading, but then the "+" operator is doing it in a valid Java program:
import java.util *; Import java.lang *; Import java.io * *; Class operator ologingtest {public static zero main (string [] args) java.lang.Exception throws {string str1 = "operator"; String str2 = "overloading"; String str3 = str1 + str2; Println (str3); }} Stout: Operator overloading
This operator is not "overloaded", it is pre-installed String Consensitivity Operator Designated Operator,
15.18.1 String Coordination Operator
+
If only one operand expression type is string, then string conversion (§5.1.11) is used to prepare strings at run time on other operands. The result of the string combination is a reference to the string object, which is a combination of two operand strings.
In other words, when Java sees
string races = string obz + some obj; someObj.toString ()
.
No comments:
Post a Comment